According to Romans 14: 5,6 Christians are neither under command to fast nor prohibited from doing so.
Fast: Abstinence from all food for a limited period. Rightly motivated fast were to show godly sorrow and repentance concerning past sins. Read 1 Sa 7:6; Joe 2:12-15; Jon 3:5.
To be acceptable, the fast had to be accompanied by correction of past sins. When Jesus was on earth he gave instruction to his disciples: " When you are fasting, stop becoming sad-faced like the hypocrites, for they disfigure their faces that they appear to men to be fasting etc... Read Matthew 6: 16-18.
Some have taken Matthew 9: 15 as a command for Christians to fast. In reality, Jesus was merely making a statement of what was goung to happen when he died. While not fasting as a religious requirement the early Christians did fast on special occasions. Read Ac 13: 2,3; 14: 23.
With this in mind and according to your question if there is any contradiction concernig Matthew 9: 14,15 and Mark 9: 28,29.
Matthew 9: 14,15 is all about the statement made by Jesus of what was going to happen when he died. While Jesus was with his disciples on earth, it was not appropriate for them to fast. When he died, they did mourn and fast. But they had no cause for mournful fasting after his resurrection and especially after the marvelous outpouring of holy spirit. Read Mark 2: 18-20; Luke 5: 33-35.
"Friends of the bridegroom" are mentioned at Matthew 9: 15. Here reference is made to other friends who joined the marriage procession and who were invited to the marriage feast. John 3: 28,29 spoke of Jesus as a bridegroom and accordingly, while Jesus was present, Jesus' disciples did not fast. later when Jesus died, his disciples mourned and had no desire to eat.
Mark 9: 28,29 is all about Jesus who rescued a demon-possessed child since his childhood.. Read Mark 9: 17,18; 20-27.
Mark 9: 28,29 show that after that event Jesus disciples asked Jesus why they were unable to expel the demon that was in the child. Jesus' respond was it was only by prayer and faith in God and not by their own power. Because earlier, when disciples had been sent forth to preach, they had expelled demons. So now, when they enter a house, they asked Jesus privately: " Why could we not expel the demon from the child?
So to answer your question about Matthew 9: 14,15 and Mark 9: 28,29, which show two different events that has nothig to do with fasting.
Kind regards
.