fn main() { let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); let mut input_iter = input.split_whitespace(); let n: usize = input_iter.next().unwrap().parse().unwrap(); let k: usize = input_iter.next().unwrap().parse().unwrap(); let mut a = Vec::new(); let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); let input_iter = input.split_whitespace(); for num in input_iter { let num: usize = num.parse().unwrap(); a.push(num); } let mut counts = vec![0; n + 1]; for i in 0..n { counts[a[i]] += 1; } counts.sort_by(|a, b| b.cmp(a)); let mut position = 0; let mut sum = 0; for i in 0..n + 1 { sum += counts[i]; if sum >= k { position = i + 1; break; } } println!("{}", position); }