#include <bits/stdc++.h>
using namespace std;
int main() {
  int cnt = 0;
  int n, boss;
  scanf("%d%d", &n, &boss);
  boss--;
  vector<int> ppl;
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    if (i == boss && a != 0) {
      a = 0;
      ++cnt;
    }
    if (i != boss && a == 0) a = 1e6;
    ppl.push_back(a);
  }
  sort(ppl.begin(), ppl.end());
  list<int> l;
  copy(ppl.begin(), ppl.end(), back_inserter(l));
  int prev = 0;
  for (auto it = l.begin(); it != l.end(); ++it) {
    if (*it > prev + 1) {
      l.insert(it, prev + 1);
      --it;
      l.pop_back();
      ++cnt;
    }
    prev = *it;
  }
  printf("%d\n", cnt);
  return 0;
}
