Was the bike low in fuel level when these problems occurred ? Did the problems go away with a full tank of fuel? If yes then definitely replace the fuel filter ... this is common cause of problems on K model bmws.
Replacing the fuel filter is a 'good' first step in eliminating it from being the cause. How long since it was last replaced? While you are there check the connections - electrical and fuel line .. Check the fuel lines for cracks .. 35psi will find any leaks .. if the filter has been replaced recently - check the connections of the fuel lines! If you need another filter in a hurry ... use a car one .. even the normal cheap plastic carby ones will withstand 35psi for a week or two .. get two just incase (and keep the original! to play safe).
If all that checks out .. unplug and clean and replug all the electrical connectors in the EFI system .. the one/s on the black box, all the sensors, coils, injectors.. 90% of problems are the connectors ..
Regards Frank Warner
motorcycles BMW R80 G/S 1981, BMW K11LT 1993, BMW K75 G/S