If cnt is equals to 0 then we have new number for Golomb Sequence 1 2 2 3 3 4 4 4 5 5 5 which is 1 + previous element
if ( cnt == 0 ) { arr [ i ] = 1 + arr [ i - 1 ] ; cnt = M . get ( arr [ i ] ) ; cnt -- ; }