Since there is no picture this is quite hard to answer but there are a few possible scenarios.
Up = y
Right = x
If it has them arranged where block 1 is to the right of block 2 and they're moving horizontally, then we can say that: (a_1x) = (a_2x)
If block 1 is projected over a cliff falling down, and block 2 is on the cliff, being pulled by block 1, then we can say that: -(a_1y) = (a_2x)
Any time one is dragging the other, using the tension of the string, then the constraint is that the magnitude of a1 would be the same as the magnitude of a2.