SNES Button Mapping Help

I'm playing NES roms via a Raspberry Pi 3 B and I'm using an SNES controller. I'd like to make the Y-button "B" and the B-button "A." It feels better for games like Super Mario, where you're pretty much always holding down "B." The SNES versions of Mario have this kind of setup - run is "Y" and jump is "B."

What's the easiest way to do this? Can somebody give me a step-by-step guide as though I'm a complete idiot? I'd like to have it so the control setup is only for the NES console on my retropie.

Any help is much appreciated. Thanks.