Efficient supervised learning in networks with binary synapses