This is the 991st most frequent Russian word.
нам
"To us" or "for us."
In this sentence, 'нам' is used as an indirect object pronoun in the dative case to indicate for whom the action is necessary.
Нам нужно пойти в магазин.
We need to go to the store.
Here, 'нам' is used as an indirect object pronoun to specify to whom the teacher addressed his words.
Учитель сказал нам, что завтра будет тест.
The teacher told us that there will be a test tomorrow.
In this sentence, 'нам' is used in a construction expressing subjective interest or liking, with 'нравится' denoting this feeling and 'нам' indicating who feels it.