The best DMs are the ones that can adapt and come up with stuff on the fly. The only guaranteed thing is that the players are idiots and will try and punch a NPC in the tavern on day 1.... throwing your well planned story out the window.
Adapt and come up with stuff on the fly? If by that you mean TPK when so much as a single dice roll diverges from my meticulously crafted grand plan, then I may just be the single greatest DM of all time.
I carefully got what I expected my party to get through for their first few sessions as maps into Roll20, fog of war so that they can only see what they'd reasonably have seen so far themselves, mood music set to play when going to the appropriate screens, snacks, and a big ass black cloak and evil laugh. Really went all out with it.
The people I first did it for ghosted me and when I went by their house later that night (parents lived down the street) everyone's cars were there
I still do whenever I get groups that want to play, but it always makes me feel like I'm wasting my time now :(
The best games I have ever ran my players would go major off-plot like spending the entire session befriending a rando NPC I didn't even have a statblock for or turning a random wilderness encounter into a sessions long war against a pack of worgs.
It took me a while to get over all the lost planning time, and it always turned out to be worth it to let my players have reign.
I am about to dm my first game and have never played any ttrpg. I have been diving so hard into content I was going insane. I stepped back, watched some YouTube on what common mistakes to avoid, watched a couple games, and even went back and spiced up the content for mines of pandelver (mainly the intro). This comic is me haha.