#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, s;
  cin >> n >> s;
  multiset<int> a;
  --s;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int now;
    cin >> now;
    if (i == s) {
      if (now != 0) ++ans;
    } else {
      if (now == 0) now = n;
      a.insert(now);
    }
  }
  for (int i = 1; i < n; ++i) {
    auto now = a.lower_bound(i);
    if (now == a.end()) break;
    if (*now != i) {
      a.erase(--a.end());
      a.insert(i);
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}
