#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, s, k;
  cin >> n >> s;
  vector<int> R;
  int w = 0;
  for (int i = 0; i < n; i++) {
    cin >> k;
    if (i == s - 1) {
      if (k != 0) w++;
    } else
      R.push_back(k);
  }
  sort(R.begin(), R.end());
  int p = 0, r = R.size() - 1;
  int rem = 0;
  int crt = 0;
  for (int i = 0; i <= r; i++) {
    if (R[i] == 0) {
      rem++;
      w++;
    } else if (R[i] == crt || R[i] == crt + 1) {
      crt = R[i];
    } else {
      if (rem == 0) {
        if (i == r)
          w++;
        else {
          i--;
          r--;
          rem++;
          w++;
        }
      } else {
        crt++;
        rem--;
        i--;
      }
    }
  }
  cout << w << endl;
  return 0;
}
