A shot in the dark, because your question is not detailed much.
So my Interpretion of your problem:
You are using Server "A" just as a Mailrelay for Domains on Server "B".
In that case Server "A" does not need to know anything about users in a domain which Server "B" is responsible for.
Use on Server "A" in your .mc:
FEATURE(mailertable, `hash -o /etc/mail/mailertable')
Then build your sendmail.cf with m4.
After doing so, setup your mailertable on Server "A":
example.com esmtp:[SERVER "B"]
Then the well known:
makemap hash mailertable < mailertable
Im running nearly the same setup and all is working fine.