#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mxN = 200001;
vector<int> arr;
int n, s;
int zero;
multiset<int> all;
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n >> s;
  arr.resize(n);
  int res = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    if (i == s - 1 && arr[i] != 0) {
      arr[i] = 0;
      res++;
    }
    if (arr[i] == 0 && i != s - 1) {
      zero++;
    }
    all.insert(arr[i]);
  }
  res += zero;
  int pos = 0;
  while (true) {
    auto it = all.upper_bound(pos);
    if (it == all.end()) break;
    int nxt = *it;
    while (nxt - pos > 1) {
      if (zero > 0) {
        zero--;
        pos++;
      } else {
        if (*all.rbegin() < nxt) {
          break;
        } else {
          all.erase(--all.end());
          res++;
          pos++;
        }
      }
    }
    pos = nxt;
  }
  cout << res << "\n";
  return 0;
}
