You should discuss the issue with both faculty members. I would bring it up with your primary advisor first...if only for linguistic reasons (i.e., the meaning of the word "primary").
When you say that the project is "going to be published", do you mean that it has already been written and accepted for publication? (If not, how do you know?) In general it is a good idea to discuss issues of coauthorship as early as possible. If you are already writing the paper it is on the later side, and if you have already submitted it then it is very late (but maybe not too late).
That's all I can think to say on general principles. It depends a lot on the field and what kind of work has been done.
tl;dr: As an undergraduate, you can't know the subtle expectations regarding coauthorship in your discipline. So err on the side of graciousness and inclusivity. The worst that can happen is that you get a "Aw, how cute: he thinks I want to publish with him" type of reaction. If so, you will definitely not have offended the faculty member and you'll probably engender a lesson about how publication culture works in your field: no problem there.