import java.util.Arrays; import java.util.Scanner; public class HelloWorld { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] pi = new int[n]; for (int i=0; i < n; i ++) { pi[i] = sc.nextInt(); } sc.close(); Arrays.sort(pi); for (int i = n - k; i < n ; i ++) { if (pi[i - 1] != pi[i]) { System.out.println(n - i); break; } if (i == n - 1) {System.out.println(0);} } } }