#include <bits/stdc++.h>
using namespace std;
int a[222222];
set<pair<int, int> > S;
set<pair<int, int> >::iterator it;
int vst[222222];
int main() {
  int N, s;
  scanf("%d %d", &N, &s);
  for (int i = 1; i <= N; i++) {
    scanf("%d", a + i);
    vst[a[i]] = 1;
    S.insert(pair<int, int>(a[i], i));
  }
  int d = 0, ans = 0;
  if (a[s]) {
    ans++;
    S.erase(pair<int, int>(a[s], s));
    a[s] = 0;
    S.insert(pair<int, int>(0, s));
  }
  int cnt = 0;
  while (!S.empty()) {
    it = S.begin();
    if (it->first == d) {
      while (it->first == d) {
        if (!d && it->second != s) cnt++, ans++;
        S.erase(it);
        if (S.empty()) break;
        it = S.begin();
      }
      if (S.empty()) break;
      if (!d) {
        it = S.begin();
        for (int i = 1; i < N && cnt; i++) {
          if (!vst[i]) {
            cnt--;
            S.insert(pair<int, int>(i, N));
          }
        }
      }
      d++;
    } else {
      ans++;
      it = S.end();
      it--;
      int id = it->second;
      S.erase(it);
      S.insert(pair<int, int>(d, id));
    }
  }
  printf("%d\n", ans);
  return 0;
}
