Hi The first is grammatical. In the second sentence, I suppose you missed out a word. I think you intended to say: You need to take into account the people walking ahead.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.