They are called fungus gnats. Spray your soil with some insecticidal soap this will kill any remaining larvae. Place 1/4-1/2 inch of sand over your potting mix.
There's something on the plant that must be attracting them. You could probably visit a store and get some safe pesticide for the plant to get rid of them.
Flies are comes in houseplants because they wanted to increase their race through these plants.Plants are support these flies giving food.Kerosene is best way to avoid these flies.