/* -*- coding: utf-8 -*- * * 1380.cc: No.1380 Borderline - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 172; /* typedef */ /* global variables */ int ps[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", ps + i); sort(ps, ps + n, greater()); ps[n] = -1; while (k > 0 && ps[k] == ps[k - 1]) k--; printf("%d\n", k); return 0; }