Upvote:1
We went for 21 days, we spent 4 nights in Hungary, 5 in Paris, 6 in Spain and a couple here and there in Belgium and Germany.
You should have applied for the visa at the Spanish consulate, since the primary portion of you visit was in Spain (6 days).
Had you also stayed in Hungary (where you applid for the visa) for 6 days, then the country you entered first (Hungary) would have been the proper country to make the application.
Since this was not the case, you are now facing this problem.
Where and how to apply
You must lodge the application for a Schengen visa at the Consulate of the country that you intend to visit, or β if you intend to visit more than one Schengen State, the Consulate of the country where you will spend the longest period.If you intend to visit several Schengen States and the stays will be of equal length, you must apply at the Consulate of the country whose external borders you will cross first when entering the Schengen area.
Sources: