Here are the key steps to solve this problem:
1) Draw a free body diagram showing all forces on each block
2) Write the ΣFx and ΣFy equations for each block
3) Substitute the relevant force equations into the ΣF equations
4) Solve the ΣF equations simultaneously to find a, T
5) Check that your solution satisfies both ΣF equations
Let me know if you need help setting up or solving the specific equations. Analyzing multi-body systems using free body diagrams and Newton's laws is an important skill.