M5-branes on Riemann Surfaces