what is woung with when engine is getting to much air and not enouth fuel? on 2003 BMW 325i

codes p0171 and p0174 what should i do to fix this problem?

Asked by for the 2003 BMW 325i
vac leak or poss mass air flow sensor
what do you mean by vac leak and could to damage my engine if i use it?