B is km East of A and km North of A. (Check this out on a diagram. I'll leave you to work these values out.)
When the ship has completed the first km leg, it is km East and km North of A. (Work these out as well.)
If it then sails a distance km on a bearing , it will travel a further distance km East and km North.
If the ship is now due North of B, its distance East of A is the same as the distance that B is East of A. So:
From this we can work out the value of and hence how far North it is of A. (You've already worked out how far East it is.)
Can you complete the working now?