#include <bits/stdc++.h>
using namespace std;
int a[201000], d[201000], p[201000], f[201000];
int n, maxn, s;
int main() {
  scanf("%d%d", &n, &s);
  memset(d, 0, sizeof(d));
  memset(p, 0, sizeof(p));
  memset(f, 0, sizeof(f));
  maxn = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    d[a[i]]++;
    if (a[i] > maxn) maxn = a[i];
  }
  int ans = 0;
  int flag = 0;
  if (a[s] != 0) {
    d[0]++;
    d[a[s]]--;
    a[s] = 0;
    flag = 1;
  }
  int tmp = 0;
  for (int i = 0; i <= maxn; i++) {
    if (i == 0) {
      tmp = (d[0] - 1);
    } else {
      if (d[i] == 0) ans++;
    }
    f[i] = ans;
  }
  ans = max(ans, tmp);
  for (int i = maxn; i >= 0; i--) {
    p[i] = p[i + 1] + d[i + 1];
  }
  for (int i = 0; i <= maxn; i++) {
    if (p[i] + tmp >= f[i]) {
      ans = min(ans, p[i] + tmp);
    } else {
      ans = min(ans, f[i]);
    }
  }
  printf("%d\n", ans + flag);
  return 0;
}
