#include <bits/stdc++.h>
using namespace std;
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= 1000000007;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a * (b / gcd(a, b));
}
long long int m, mx = -1, i, j, n, d, t, q, tmp, flag = 0, k, pos,
                 bpos = 123456789, x, y, s, ans;
pair<long long int, long long int> pa[223456];
long long int inp[223456];
long long int cnt[223456];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> s;
  long long int n1;
  for (i = 0; i < n; i++) {
    cin >> inp[i];
    cnt[inp[i]]++;
  }
  if (inp[s - 1] != 0) {
    cnt[inp[s - 1]]--;
    cnt[0]++;
    inp[s - 1] = 0;
    ans = 1;
  }
  int diff = cnt[0] - 1;
  ans += diff;
  i = 1;
  while (diff > 0) {
    if (cnt[i] == 0) {
      diff--;
      cnt[i] = 1;
    }
    i++;
  }
  for (i = 0; i < n; i++) {
    if (cnt[i] > 0) n1 = i;
  }
  i = 1;
  j = n1;
  while (i < j) {
    if (cnt[i] == 0) {
      cnt[i] = 1;
      ans++;
      cnt[j]--;
      if (cnt[j] == 0) {
        while (j >= 0 && cnt[j] == 0) {
          j--;
        }
      }
    }
    i++;
  }
  cout << ans;
  return 0;
}
