using static System.Math; using System.Linq; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var k = int.Parse(line[1]); line = Console.ReadLine().Trim().Split(' '); var p = Array.ConvertAll(line, int.Parse); getAns(k, p); } static void getAns(int k, int[] p) { var ans = 0; for (int i = 0; i <= 400; i++) { var ok = p.Count(x => x > i); if (ok <= k) ans = Max(ans, ok); } Console.WriteLine(ans); } }