#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int a[maxn];
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  int ans = 0, re = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (i == s) {
      if (x != 0) ans++;
    } else {
      a[x]++;
    }
  }
  ans += a[0], re += a[0];
  int r = n - 1;
  while (r >= 1 && !a[r]) r--;
  for (int l = 1; l <= r; l++) {
    if (a[l])
      continue;
    else {
      if (re)
        re--;
      else {
        ans++;
        a[r]--;
        while (r >= l && !a[r]) r--;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
