"Does everyone want coffee?" propositional logic problem 
When three professors are seated in a restaurant, the hostess asks them: “Does everyone want coffee?” The first professor says: “I do not know.” The second professor then says: “I do not know.” Finally, the third professor says: “No, not everyone wants coffee.” The hostess comes back and gives coffee to the professors who want it. How did she figure out who wanted coffee?

The solution is that the first two professors who say they don't know if everyone wants coffee are the ones who want coffee.
However, I don't understand the logic. For example, the first professor may not want coffee, but does not know if the other professors want coffee, and thus can answer "I do not know." So how can the hostess take an answer of "yes" from that?

Suppose the first professor did not want coffee. Then, they would know that it is not the case that "everyone wants coffee" - so, when asked "Does everyone want coffee?," they would answer "no."
