#include <bits/stdc++.h>
using namespace std;
int md[200001] = {0};
int main() {
  memset(md, 0, sizeof(md));
  int n, s;
  int sum = 0;
  cin >> n >> s;
  int ans = 0, x, maxn = 0;
  set<int> q;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (i == s && x != 0) {
      sum++;
      x = 0;
    }
    md[x]++;
    maxn = max(maxn, x);
    q.insert(x);
    if (x == 0) {
      ans++;
    }
  }
  set<int>::iterator it = q.end();
  it--;
  ans--;
  for (int i = 1; i <= maxn; i++) {
    if (md[i] == 0) {
      sum++;
      if (ans != 0) {
        ans--;
      } else {
        md[maxn]--;
        if (md[maxn] == 0) {
          it--;
          maxn = *it;
        }
      }
    }
  }
  if (ans != 0) sum += ans;
  cout << sum << endl;
  return 0;
}
