#include <bits/stdc++.h>
using namespace std;
const long long int m = 1e9 + 9;
long long int Lpow(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b % 2) ans = (ans * a) % m;
    a = (a * a) % m;
    b = b / 2;
  }
  return ans;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n, s;
  cin >> n >> s;
  vector<int> arr(n);
  multiset<int> sete;
  int x;
  int ans = 0;
  int avai = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (i + 1 == s && x != 0) {
      ans++;
      arr[0]++;
      sete.insert(0);
    } else if (x == 0 && i + 1 != s) {
      avai++;
      ans++;
    } else {
      arr[x]++;
      sete.insert(x);
    }
  }
  int tot = 0;
  for (int i = 0; tot != n; i++) {
    if (arr[i] == 0 && avai >= 1) {
      avai--;
      arr[i] = 1;
      tot++;
    } else if (arr[i] == 0) {
      arr[i] = 1;
      arr[*(--sete.end())]--;
      sete.erase(--sete.end());
      tot += 1;
      ans++;
    } else
      tot += arr[i];
  }
  cout << ans << '\n';
  return 0;
}
