Y will store the frequency of num in the minimum K elements
Y = 0 ; NEW_LINE for i in range ( k - 1 , - 1 , 1 ) : NEW_LINE INDENT if ( arr [ i ] == num ) : NEW_LINE INDENT Y += 1 NEW_LINE DEDENT DEDENT