For each location (B1,...,Bp), create a list that contains the houses that are within X distance from that location.
Create a list of houses (lets call this list "NeedToCover") that initially contains all of the houses.
Now go through each location's list and determine which location's list covers the most houses in the "NeedToCover" list. This will be the the location where you will build your facility.
After building the facility, remove all the houses in "NeedToCover" that was covered by that location that you had just picked.
Repeat the above steps with the remaining houses in "NeedToCover" and the remaining locations until "NeedToCover" is empty, in which that means all houses are within X distance from a facility.
(This algorithm is greedy because each time you are picking the location that covers the most houses out of the remaining houses "without regard for the future.")