Merge two arrays preserving the order of shared items.