Hi Oleg,
I'm note sure that I'm going to explain this very well, but I'll give it a try - it's one of those things that native English speakers tend to do intuitively.
"The" is used to refer to one specific item or indeed to the only existing item in a particular context.
"A" is used to refer to a non-specific / random item or to one of many items in a group.
Examples
1) The dog caught the ball.
Which dog? In this case we would be talking about a specific dog.
It could be said in a conversation about my dog, where I was talking about my specific dog.
Or if we were talking about a park in which there was only one dog, we would use "the" because there are no other dogs in that situation and we know immediately which dog we mean.
2) A dog caught the ball.
Which dog? In this case we could be talking about any dog.
It could be said in a general conversation about pets, where I was telling a story about a random non-specific dog catching a ball.
Or if we were talking about a park in which there were many dogs, I would use "a" to mean any one of the dogs in that group.
Of course (and just to confuse) if my dog was one of the many in the park I might say "the dog" to refer to my particular dog, as in the example above.
The easiest way to check yourself on this is to think about the plurals because they're often easier to get right. Using the examples above, the plurals would be :
1) The dogs caught the balls.
(Which dogs? Those specific dogs over there)
If that is what you would say in the plural, use "the" for the singular.
2) Some dogs caught the balls
(Which dogs? I don't know - just some dogs / any dogs)
If that is what you would say in the plural, use "a" for the singular.
And in situations where you might also say :
One of the dogs caught the ball.
use "a"
EDIT : While I was trying to explain all that, Pete's already posted but he seems to have approached it the opposite way. Hopefully, we haven't managed to completely confuse you.