41:1

וַיְהִי מִקֵּץ שְׁנָתַיִם יָמִים וּפַרְעֹה חֹלֵם וְהִנֵּה עֹמֵד עַל־הַיְאֹר׃

And it was at the end of two full years: Pharaoh was dreaming, and behold, he was standing by the Nile.

Bereshit 41:1

וַיְהִי מִקֵּץ שְׁנָתַיִם

Bereshit / Genesis 41:1

וַיְהִי מִקֵּץ שְׁנָתַיִם יָמִים וּפַרְעֹה חֹלֵם וְהִנֵּה עֹמֵד עַל־הַיְאֹר׃

And it was at the end of two full years: Pharaoh was dreaming, and behold, he was standing by the Nile.

Pshat פְּשָׁט

A dream by the river

Rashi: "at the end" (מִקֵּץ) means "at the close", and the Torah calls only the Nile by the word "river" (יְאֹר): Egypt lives not by rain but by the Nile rising through its canals. Radak: the dream came from God, like prophecy. The wise men of Egypt could not solve it, so that Yosef would rise to greatness.

How Rashi and Radak explain it

Remez רֶמֶז

Ten, and two more

Baal HaTurim: the word "at the end" (מִקֵּץ) also appears with Avraham: "at the end of ten years" (16:3). So here too ten years are meant, and two more. Agra DeKala: the "two years" are the two thousand years of "chaos" before Avraham. Pharaoh (פַּרְעֹה) comes from "to uncover", and "dreams" (חֹלֵם) from "to heal": the revelation of Torah begins to enter the world.

How Kitzur Ba'al HaTurim and Agra DeKala explain it

Drash דְּרָשׁ

He set an end to darkness

Bereshit Rabbah: God set the world a time, how many years it would be in darkness, and set Yosef a time, how many years he would sit in prison. When the end came, Pharaoh dreamed. Tanchuma: Yosef was due ten years, but he twice relied on the cupbearer, "remember me" and "mention me", and was given two more years.

How Bereshit Rabbah and Midrash Tanchuma (Buber) explain it

Sod סוֹד

The evil mouth pleads for mercy

Degel Machaneh Ephraim: "at the end" is the last of the sefirot, Malchut. When she is joined with the Holy One, all good comes. Then "Pharaoh" (פַּרְעֹה), that is "an evil mouth" (פֶּה רַע), "dreams" (חֹלֵם), that is "has pity" (חוֹמֵל): the accuser himself pleads for Israel. Baal Shem Tov: the "end of darkness" comes when a person raises the sparks of holiness fallen into the husks, through Torah, commandments and even eating.

How Degel Machaneh Ephraim and Ba'al Shem Tov explain it