The centroid is 2/3 of the distance from each vertex to the midpoint of the opposite side.
Thus, the distance AD (x+2) is two-thirds of the distance from A to M,
The distance from A to M is the sum of the distance from A to D (x + 2) and D to M (2x - 6) = 3x - 4
so x + 2 = 2/3 * (3x - 4)
3x + 6 = 2 (3x - 4)
3x + 6 = 6x - 8
14 = 3x
14/3 = x
AM = 3x - 4 = 3(14/3) - 4 = 10