It appears that when you write "2 days" you mean "2 nights", which isn't the same thing. Two nights somewhere gives you just one full day plus some hours--a number that varies depending on how early a start you get on the day you change cities and how much transportation time is required, which isn't just the time you spend sitting on a train, bus or plane.
Art museums aside, Madrid isn't a huge favorite of mine, but realize that if you give only 2 nights to Madrid at the beginning of the trip, that's probably just one day. You may be too sleep-deprived and jetlagged on your arrival day to function well, and you may not be in great shape even the next day.
The Picasso Museum is often unbelievably crowded. I recommend it only if you are a serious fan. There are other art museums in the cities you are visiting that would be less mobbed. If you do decide to go there, it's quite possible you'll need to buy a ticket (day- and time-specific) ahead of time. The museum sometimes sells out. Even if it doesn't, you might arrive in the morning and be told the first available ticket is for 2:45 PM or something like that. On a short visit, that sort of thing can bring the sightseeing plan crashing down.
There are several other sights in Barcelona for which you have traditionally needed to buy a ticket ahead of time (not necessarily very far ahead of time) if you don't want the joy of an hour-long (or longer) ticket line when you arrive at the sight--which again could leave you with a ticket for several hours in the future. Those sights include La Sagrada Familia, Parc Guell, Casa Mila/La Pedrera, Casa Batllo, and the Palau de la Musica Catalana. Things may be a bit looser these days, if tourist number are down substantially, but I don't know whether the situation is enough better to chance just showing up without a ticket in hand. The (possible/probable) need to buy tickets ahead of time is a challenge. On a short trip, especially, you naturally wnat to be an efficient sightseer, but you have no way of knowing how much of a gap you need to leave between your ticketed entry times at Sight A and Sight B, and so on.