I have read in one of the websites (VisaPro.com) that beneficiaries with a previously approved H1B petition are eligible for cap-exempt filing, subject to a few conditions. Please read below the excerpt from that site.
“The H1B Cap exemption also applies to workers who are currently outside the US, as long as they held an H1B visa status during the past six years, have not exhausted the full six years, and have not spent a full year outside the US.”
“and have not spent a full year outside the US” - except for this condition, you are eligible for cap-exemption.
Its better to get your case clarified with company B or any immigration attorney.