Genesis 45:4-7 ESV
So Joseph said to his brothers, “Come near to me, please.” And they came near. And he said, “I am your brother, Joseph, whom you sold into Egypt. And now do not be distressed or angry with yourselves because you sold me here, for God sent me before you to preserve life. For the famine has been in the land these two years, and there are yet five years in which there will be neither plowing nor harvest. And God sent me before you to preserve for you a remnant on earth, and to keep alive for you many survivors.
Joseph perceived that God had used him to preserve a remnant of His people on earth. This foreshadows Christ Jesus doing the same by sealing the twelve tribes during the great tribulation. A remnant shall be saved.
I wonder if there is a connection between the five months in Revelation and the five years of famine in Egypt?
Revelation 9:5-6
They were allowed to torment them for five months, but not to kill them, and their torment was like the torment of a scorpion when it stings someone. And in those days people will seek death and will not find it. They will long to die, but death will flee from them.