n = gets.to_i k = gets.to_i scores = [] puts 1 (n-1).times do |i| scores << gets.to_i scores = scores.sort { |a, b| b - a } puts scores.index(k) + 1 end