Air Europa have an alliance and code share with Hungarian national carrier Malev so you may well get a good deal BCN-MAD and on to Budapest on Malev which is a daily service. Air Europa will sell/issue the ticket.
I think E300 is a good price from KLM for that routing but going via AMS takes you a long way off track