n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
puts (0..400).map { |i| a.count { _1 >= i } }.select { _1 <= k }.max