#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int cnt = 0;
  if (a[s - 1] != 0) {
    a[s - 1] = 0;
    ++cnt;
  }
  int counter = -1;
  map<int, int> dict;
  for (int i = 0; i < n; ++i) {
    ++dict[a[i]];
  }
  for (int i = 0; i < n; ++i) {
    counter += a[i] == 0;
  }
  cnt += counter;
  int ind = 0;
  while (ind < n && counter > 0) {
    if (dict[ind] == 0) {
      dict[ind] = 1;
      --counter;
    }
    ++ind;
  }
  while (dict[ind] != 0) ++ind;
  for (int i = n - 1; i >= ind; --i) {
    if (dict.count(i)) {
      while (dict[i] > 0 && ind < i) {
        ++cnt;
        dict[ind] = 1;
        --dict[i];
        while (dict[ind] != 0 && ind < i) ++ind;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
