#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 0;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return f ? x : -x;
}
long long n, s, box[200010], zero, sum = 1, ans;
signed main() {
  n = read(), s = read();
  for (long long i = 1; i <= n; i++) {
    long long x = read();
    if (!x && i != s)
      zero++;
    else if (i == s && x)
      ans++;
    else
      box[x]++;
  }
  for (long long i = 1; i < n; i++) {
    if (sum >= n) break;
    if (box[i])
      sum += box[i];
    else {
      if (zero) zero--;
      sum++;
      ans++;
    }
  }
  printf("%lld", ans);
  return 0;
}
