Genesis 40:1-4 NIV
Some time later, the cupbearer and the baker of the king of Egypt offended their master, the king of Egypt. Pharaoh was angry with his two officials, the chief cupbearer and the chief baker, and put them in custody in the house of the captain of the guard, in the same prison where Joseph was confined. The captain of the guard assigned them to Joseph, and he attended them.
After they had been in custody for some time
NIV: New International Version