Hello Ilija, and welcome to the forum!
There are a number of insects that will happily take over your cupboards. Unfortunately, I can't tell from your photos which one(s) you have. Here's a link to some good information, maybe it will help you identify your critters.
http://ipm.ucanr.edu/PMG/PESTN...
Pantry pests live on almost anything--flour, cereal, rice, pasta, pancake mix, dried fruit, crackers, cookies, spices, pet food and many other edibles. Once they're established, it takes some time to get rid of them for good, but it can be done.
Sounds like you've already taken the first step--get rid of everything in the cupboard, and clean up any spilled food.
New food coming in should be stored in the freezer for a week first, that will kill any incoming bugs. As much as possible, keep these items in the freezer or refrigerator until you're ready to use them.
Everything in the cupboard needs to be in a tightly sealed container--glass, metal or heavy plastic. The top needs to be very tight fitting. Only store small quantities in the cupboard, keep everything else in the freezer or 'fridge. Don't store anything in paper, cardboard, or thin cellophane/plastic.
I wouldn't spray insecticide in the kitchen. It's not going to solve the problem and exposes you and your family to toxic chemicals.
Carefully get rid of contaminated food, clean up even small spills, and keep most food items either tightly sealed in heavy containers, or stored in the freezer/fridge. When they can't get to their food, they'll die off.
Stay vigilant, now that you know what they look like you can be prepared to deal with them immediately if they reappear.
Good Luck!