hint:

find the initial conditions of both blocks seperately. Add up the initial energies and that is your starting point. Some of this energy will be lost to friction between block A and the ramp, but the rest will still be around in either PE or KE. Find the change in PE and then use the rest of the remaining energy for the KE.