A permutation test randomly resamples the data to create a "null distribution" (a distribution of test stats that you'd see under the null hypothesis). This video demos how to set up a hypothesis test in R to compare two means.
Correction! The denominator should be m+1 (rather than m).