I would say the "the" in your second sentence is optional, just to add to the confusion.
Perhaps someone with a lot more knowledge of grammar than I have can explain to you when an article is needed, but generally in English, nouns tend to be proceeded by one. Like prepositions, articles have a lot of quirks. I imagine a decent grammar book will explain most of them, probably in the first chapter.
I hope that is of some help.