The F87 is the M2, built from 2016 to 2021, and regarded by many as the last compact M car of the old school: short wheelbase, rear-wheel drive, a manual gearbox if you wanted one. The later Competition and CS versions took the S55 from the M3 and M4; early cars used the N55.
What separates it from the F22 is mostly width. Front and rear wings are flared, bumpers and sills are M-specific, the track is wider. An F22 wing will not fit, and you can see that just by holding one up against the car.
Shared are the doors, roof, bonnet and boot lid — there the M2 is an ordinary 2 Series Coupé. Headlights and rear lights follow the model too, including the 2017 LCI change. So what we can offer is the F22 side of it: condensers, door cards, fog lamps.
The cabin is where it gets deceptive: seats, wheel and dials are M items, but the climate panel, the door handles and the electronics behind them are ordinary F22. That is precisely where comparing part numbers pays, because parts that look identical can be coded differently.