#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int main() {
  auto start = high_resolution_clock::now();
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, s;
  cin >> n >> s;
  --s;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];
  int ans = 0;
  if (h[s] != 0) ++ans;
  h[s] = h.back();
  h.pop_back();
  sort(h.begin(), h.end());
  size_t pos = 0;
  int max_good_h = 0;
  int free = 0;
  while (pos < h.size() && h[pos] == 0) {
    ++ans;
    ++free;
    ++pos;
  }
  while (pos < h.size()) {
    if (h[pos] == max_good_h + 1) {
      ++max_good_h;
      ++pos;
    } else if (h[pos] > max_good_h) {
      if (free > 0) {
        --free;
      } else {
        ++ans;
        h.pop_back();
      }
      ++max_good_h;
    } else {
      ++pos;
    }
  }
  cout << ans << endl;
  cerr << "Total execution time : "
       << duration_cast<milliseconds>(high_resolution_clock::now() - start)
              .count()
       << " ms" << endl;
  return 0;
}
