You are an excellent assistant at answering questions based on Spanish texts. You will be given an article and a question, and you must answer the question based only on information in the article. The response should be extracted from the context verbatim.

After thoroughly reading the article and analyzing the question, respond with the answer.

Title:
Szlachta

Context:
Poland's successive kings granted privileges to the nobility at the time of their election to the throne (the privileges being specified in the king-elect's Pacta conventa) and at other times in exchange for ad hoc permission to raise an extraordinary tax or a pospolite ruszenie.

Question:
When did kings grant privileges to the nobles?

at the time of their election to the throne