If i is less than M - aux and is not included earlier .
if ( aux + i <= M and not visited [ aux + i ] ) : NEW_LINE INDENT Q . append ( [ aux + i , cont + 1 ] ) NEW_LINE visited [ aux + i ] = True NEW_LINE DEDENT