using System.Collections.Generic; using System.Linq; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var k = int.Parse(line[1]); var d = new Dictionary(); line = Console.ReadLine().Trim().Split(' '); foreach (var x in line) { var w = int.Parse(x); if (d.ContainsKey(w)) d[w]++; else d[w] = 1; } getAns(k, d); } static void getAns(int k, Dictionary d) { var count = 0; foreach (var x in d.OrderByDescending(x => x.Key)) { if (count + x.Value > k) { Console.WriteLine(count); return; } else count += x.Value; } Console.WriteLine(count); } }