more Mth to last element, Number of Ones

Lua