Let us consider incline surfaces of wedge as x-axis and y-axis respectively. We can write accelerations of blocks A and B.
→aA=mg sin 30∘^i and →aB=mg sin 60∘^j The acceleration of centre of mass of two blocks can be written as
→aam=mA→aA+mB→aBmA+mB=mg sin 30∘^i+mg sin 60∘^jm+m =g sin 30∘^i+mg sin 60∘^jm+m =g4^i+√3g4^j⇒|→aam|=g2