Matthew 17:20 says it is because they had so little faith:
Then the disciples came to Jesus in private and asked, “Why couldn’t we drive it out?” 20 He replied, “Because you have so little faith.
But then Matthew 17:21 says
He replied, “This kind can come out only by prayer
Mark 9:29 says the same as the above. So what is the reason the disciples couldn't drive out the demon, a lack of faith or lack of prayer?