Start with a basics
Take the MAF sensor off clean with a carb cleaner.
Or if can get your hands on working MAF sensor plug it in see if it will solve you problem.
BMW is very picky on the reading it gets for the MAF. The range of problems can be cause by it is huge.
Please re-read the codes. It will help you determine further action.