Upfront (UFMIP) and Annual mortgage insurance premiums (MIP) should be based on the average outstanding principal obligation of the first mortgage only.
The note and second mortgage are not to be included in the Upfront and Annual MIP associated with the purchase of a Good Neighbor Next Door (GNND) property.
For additional information see Handbook 4000.1 Section II.A.8.o.vi(C) available at: https://www.hud.gov/program_offices/administration/hudclips/handbooks/hsgh