#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
multiset<int> S;
multiset<int>::iterator it;
int n, s, ans, tmp, p = 1, ye;
int f() {
  it = S.begin();
  for (int i = 0; i < S.size(); i++) {
    cout << *it;
    it++;
  }
  cout << endl;
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    if (i == s && tmp != 0) {
      ans = 1;
      continue;
    } else if (i == s && tmp == 0) {
      ans = 0;
      continue;
    } else if (i != s && tmp == 0) {
      tmp = n;
    }
    S.insert(tmp);
  }
  while (S.size() > 0) {
    tmp = *S.begin();
    if (tmp == p) {
      S.erase(p);
    } else {
      ans++;
      it = S.end();
      it--;
      S.erase(it);
    }
    p++;
  }
  cout << ans;
  return 0;
}
