Find the sum of last M numbers .
sum = 0 NEW_LINE i = len ( distinctDigitSum ) - 1 NEW_LINE while ( i >= 0 and m > 0 ) : NEW_LINE INDENT sum += distinctDigitSum [ i ] NEW_LINE i -= 1 NEW_LINE m -= 1 NEW_LINE DEDENT return sum NEW_LINE