The answer is dried dates:
Ahmed took some dried dates, counted out forty, and placed them in a jar. “I will eat one of these dates each evening. That will tell me when my forty days are done.”
Ahmed was counting the days until he had to come up with an answer for the King.
The story is a relatively short read. Read carefully and be sure you check your comprehension as you read. Any other answers you need should be easy to find as long as you are reading thoroughly and understanding what you read.