Yonah 4 - #1 of 2
Hashem punishes those who sin against him - מדה כנגד מדה – measure for measure. The Yalkut Shimoni explains that because Pharoh questioned Hashem’s existence saying: “ה' אשר אשמע בקולו מי – Who is Hashem that I must listen to His voice?” Hashem punished him by drowning his army in the “ים”, which has the same letters (and thus gematria) as “מי”. Pharoh questioned Hashem’s existence using the word מי and was punished by Hashem revealing Himself at the ים.
In the Haggadah, R’ Yosi HaGelili holds that Hashem plagued the Egyptians with 50 makkos at the ים סוף. Both ים and מי share the gematria, 50, further alluding to the Yalkut Shimoni’s point, that it was a מדה כנגד מדה punishment for Pharoh’s sin.
To extend this idea, another Midrash relates that as Pharoh was drowning, he did teshuva which Hashem accepted, and was saved. It says in Beshalach that Pharoh said “כמוך נאדר בקודש מי כמוך באלים ה מי – Who is like You amongst the mighty? Who is like You, mighty in holiness?” Thus Pharoh used the word מי to acknowledge his sin of מי, and to acknowledge Hashem and His virtue of מדה כנגד מדה, in order to do teshuva.
Finally, the Midrash relates that Pharoh fled to Ninveh, where he was the king in the time of Yonah, and that when Yonah came to rebuke the people, he listened because he knew the power of Hashem. In response to Yonah’s prophecy, the king of Ninveh announced: “יודע ישוב ונחם האלוקים מי – Whoever knows how to do teshuva, should do so, because Hashem will forgive him.” This could only have been Pharoh – only Pharoh knew that he had sinned through the מי and done teshuva through the word מי which had been accepted. Therefore, he could confidently assure the people of Ninveh that they too could do teshuva and be forgiven.