import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); TreeMap map = new TreeMap<>(); for (int i = 0; i < n; i++) { int p = sc.nextInt(); map.put(p, map.getOrDefault(p, 0) + 1); } sc.close(); int ans = 0; while (!map.isEmpty()) { int v = map.pollLastEntry().getValue(); if (ans + v > k) { break; } ans += v; } System.out.println(ans); } }