#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ans = 0;
  if (a[s - 1]) {
    ans++;
    a[s - 1] = 0;
  }
  vector<int> cnt(n);
  for (int i = 0; i < n; ++i) {
    cnt[a[i]] += 1;
  }
  int r = 0;
  if (cnt[0] > 1) {
    r = cnt[0] - 1;
    ans += r;
  }
  int j = n - 1;
  while (cnt[j] == 0) j--;
  for (int i = 1; i < j; ++i) {
    if (cnt[i]) continue;
    if (r) {
      r--;
      continue;
    }
    ans++;
    cnt[j] -= 1;
    while (cnt[j] == 0) j--;
  }
  cout << ans << '\n';
}
