It's brute force crude, but I like it. :D
The one caveat is that you have to make sure there is a path for the current when the B supply goes off that will turn on RLY2, for example if the B supply were simply just disconnected.
To avoid that possible problem, below is the simulation of a one...