merge B into A in sorted order