#include <bits/stdc++.h>
using namespace std;
int a[200000 + 5], cnt[200000 + 50];
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int ans = 0;
  if (a[s - 1] != 0) {
    a[s - 1] = 0;
    ++ans;
  }
  for (int i = 0; i < n; ++i) {
    if (a[i] != 0)
      cnt[a[i]]++;
    else if (i != s - 1)
      ++cnt[200000 + 5];
  }
  sort(a, a + n);
  int p = 1, q = 200000 + 5;
  while (p < q) {
    while (p < q && !cnt[q]) --q;
    while (p < q && cnt[q]) {
      while (p < q && cnt[p]) ++p;
      if (p < q) {
        ++cnt[p];
        --cnt[q];
        ++ans;
      }
    }
  }
  printf("%d\n", ans - cnt[200000 + 5]);
  return 0;
}
