Need help modelling and coding a feedback scenario
Well, (very) simply you could slowly increase/decrease the PWM value driving M2 until the voltage at A1 equals that of A2. If you make the time between adjustments long enough you should not get any (significant) oscillations.

However, more likely you want to get to the correct M2 PWM value quickly and for that you need a Proportional, integral, Differential (PID) control algorithm. Explaining this in detail is outside the scope of a S.E. answer, but in summary:

You have a value that signifies the current state of the system - which will be the A2 reading. 
You also have a value that states where you want to get to - which will be the A1 reading.
You also have a control value - which will be the PWM value of M2

The Proportial part looks at how far away the A2 reading is from the A1 reading.
The  Integral part looks at how quickly we (the A2 reading) are moving towards (or away from) the desired value (the A1 reading). The Differential part looks at how long we have been away from the desired value.

Each of these (PID) parts (with tuning values that you set) contributes towards determining a new value for PWM at M2 and this iterates around with new values getting the current state closer and closer to the desired value.

There are lots of Arduino PID examples around. I'd suggest you read up on the algorithm itself and have a look at the Arduino.cc samples here.