Short version:
Keyboard/mice aren't an issue, 2015's are fine, wise choice on SSD.
Long version:
An SSD is indeed essential on the 21.5". The default 5400rpm HDDs are a downgrade. On a 27" you could get away with a Fusion since those are an objective upgrades over a 2011's HDD (although SSDs are still preferred).
Peripherals are easy, just buy a 3rd party mac keyboard (Logitech makes good keyboards) and your favorite 3rd party mouse (I've been less impressed with Logitech mice).
As for vintage...
2013 is probably the best value performance wise, but is also next in line to loose support. I'm betting those will only run one more version of MacOS before Apple starts requiring newer. In ~3 years those will be where a 2011 is today.
2015 is a decent year. Closer to 2013 than 2017 in performance but they seem reliable and are still comfortably mid-life. Just remember that the 21.5" models don't have upgradable RAM so, so if you plan to keep it until the security updates end then finding something with 16GB Ram could be beneficial.
You might also consider looking at the used macs sold by OWC (macsales.com). Slightly more expensive and less variety than macofalltrades, but they're willing to preinstall upgrades where possible as a build-to-order.