Calling setM1Speed(0) sets the motors to full coast. Calling setM1Brake(400) shorts the motor leads to GND and inductively brakes the motor. You can find more information on this in the dual VNH5019 motor shield Arduino library page.
When braking the motor, the motor driver shorts the motor leads together through ground, which causes the motor to electrically brake. When configured for coasting, the motor driver outputs are turned off and the motor leads are effectively floating/disconnected.
You can test the two scenarios for yourself by disconnecting the motor from the driver and spinning the output shaft by hand, first with the leads separated (full coast) and then again with the leads held shorted together (brake).