First the king will ask the leader of the party with the most seats (Feijóo, PP, conservative right) to try and form a government, they can refuse if they see it unlikely or impossible. Then they vote, more ayes and there's a president. More nays, back to step 1 with the leader of the second party (Sánchez, PSOE, centre-left~centre-right). If no one can achieve a coalition big enough there will be elections again