Genesis 40:1-6 NLT

1 Some time later, Pharaoh’s chief cup-bearer and chief baker offended their royal master.
2 Pharaoh became angry with these two officials,
3 and he put them in the prison where Joseph was, in the palace of the captain of the guard.
4 They remained in prison for quite some time, and the captain of the guard assigned them to Joseph, who looked after them.
5 While they were in prison, Pharaoh’s cup-bearer and baker each had a dream one night, and each dream had its own meaning.
6 When Joseph saw them the next morning, he noticed that they both looked upset.