Linear and nonlinear simulations of the visco-resistive internal kink mode using the M3D code