stack implementation
mth to last element