Taking my research idea outside my paid job
If the idea is valuable you should talk to an attorney. 

You want to avoid encumbrances.  If there is some small chance that if the idea hits it big, A can claim some ownership, the thing to do is to get a letter stating that A waives all claims around this idea.

There are also time-sensitive issues surrounding your situation from the perspective of protecting IP.  In your conversations with A and B, you might have "disclosed", starting a clock starting for patent procedures.

Again, if it's important, this is what lawyers are for.