For Mario I can't recall specifically which I played first, since several were among my first video games in general and I started playing them when I was like 2. So it was probably either Super Mario Bros. 1 or 2 for the NES, but there's also a chance it was Super Mario All-Stars or World.
As for Sonic, that'd be Sonic Adventure on Dreamcast. Technically some demo disc that included just Emerald Coast among other game demos before I got the full game. I remember just running through that level a lot, aha. That was also around when I got a Sonic plush, and there was just something really cool about having a toy of a game character at the time, considering that was before video game merch was widespread at all.
First Mario Game: Super Mario Bros 1 in a pirate nes console. ;-;
First Sonic Game: Sonic 2 in emulator.
Well don't feel bad about first playing SMB on a Dendy or whatever the hell you played it on. At least you sort of grew up with the real thing! All I grew up with were shitty half completed flash games! Like most of them weren't even finished! If only I knew about Emulators/ROMs back then...