Added solution for mth to last element