Some time later, the Egyptian king's baker and wine taster did something their master didn't like.
References for Genesis 40:1
So Pharaoh became angry with his two officials, the chief wine taster and the chief baker.
He put them in prison in the house of the captain of the palace guard. It was the same prison where Joseph was kept.
The captain put Joseph in charge of those men. So Joseph took care of them. Some time passed while they were in prison.
Then each of the two men had a dream. The men were the Egyptian king's baker and wine taster. They were being held in prison. Both of them had dreams the same night. Each of their dreams had its own meaning.
Joseph came to them the next morning. He saw that they were sad.