That is not a B Unit that is a HEP (Head End Power) Hotel Power Generator car that provides heat and electricity for the passenger.
Some of these HEP Units are modified F B Units. Ontario Northland Railway and GO Transit are some prime examples modifing either F7 or F9 B Units (not sure which) by removing the locomotive primemover and replacing it with an HEP Generator.
Actually the second car in that pic is called a Steam Generator Unit.
When CN dieselized, they needed steam heat for the passenger cars and these cars were built with boilers in them to create steam heat.