#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &res) {
  char c;
  res = 0;
  while ((c = getchar()) < '0' || c > '9')
    ;
  while (c >= '0' && c <= '9') {
    res = res * 10 + (c - '0');
    c = getchar();
  }
}
int n, s, ans;
int a[200050];
int main() {
  read(n);
  read(s);
  for (int i = 1; i <= n; i++) {
    int tmp;
    read(tmp);
    if (i == s && tmp != 0) {
      ans++;
      continue;
    }
    a[tmp]++;
  }
  for (int i = 1, now = 1;; i++) {
    if (now >= n) break;
    if (!a[i])
      now++, ans++;
    else
      now += a[i];
  }
  printf("%d\n", ans);
}
