Small flies that buzz around your plants are most probably fungus gnats. The simplest method of getting rid of them is to dry out the soil between watering, use sticky traps, and put a layer of sand on the soil to stop larvae. Additionally, you can soak the soil with a mild neem oil solution to kill the larvae. Most importantly, don't overwater since that's the main culprit.