#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
const int MAXN = 212345;
int n, m, k;
int s[MAXN];
int main() {
  scanf("%d %d", &n, &k);
  k--;
  int z = 0;
  for (int a = 0; a < n; a++) {
    scanf("%d", &s[a]);
    if (!s[a]) z++;
  }
  int res = 0;
  if (s[k] != 0) {
    s[k] = 0;
    res++;
  } else
    z--;
  res += z;
  sort(s, s + n);
  int val;
  int j = n;
  for (int a = 1; a < j; a++) {
    if (s[a] == s[a - 1] || s[a] == s[a - 1] + 1) continue;
    val = s[a - 1];
    val += min(z, (s[a] - s[a - 1]) - 1);
    z -= min(z, (s[a] - s[a - 1]) - 1);
    if (val >= s[a] - 1) continue;
    while (val < s[a] - 1 && a < j) {
      val++;
      j--;
      res++;
      ;
    }
  }
  printf("%d\n", res);
}
