Question:
Which position did Ildefonso Díez de Rivera, Count of Almodóvar hold in May, 1840?

Context:
 Ildefonso Díez de Rivera, Count of Almodóvar holds the position of Minister of State of Spain from Jun, 1842 to May, 1843. 
 Ildefonso Díez de Rivera, Count of Almodóvar holds the position of President of the Spanish Senate from Jan, 1840 to Jan, 1842. 
 Ildefonso Díez de Rivera, Count of Almodóvar holds the position of ministro de la Guerra from Feb, 1837 to Sep, 1837. 
 Ildefonso Díez de Rivera, Count of Almodóvar holds the position of Captain General of Mallorca from Jan, 1823 to Jan, 1823. 
 Ildefonso Díez de Rivera, Count of Almodóvar holds the position of General captain of Valencia from Jan, 1820 to Jan, 1822.

Answer:
President of the Spanish Senate