#include <bits/stdc++.h>
using namespace std;
int n, s;
int ar[300005];
vector<int> pr;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> s;
  int free = 0;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] && i != (s - 1))
      pr.push_back(ar[i]);
    else
      free++;
  }
  free--;
  int fl = 0;
  if (ar[s - 1]) {
    fl++;
  }
  int l = 0;
  int r = pr.size() - 1;
  int cu = 1;
  int ans = free + fl;
  sort(pr.begin(), pr.end());
  while (l <= r) {
    if (pr[l] < cu) {
      l++;
      continue;
    }
    if (pr[l] == cu) {
      l++;
      cu++;
      continue;
    } else if (free > 0) {
      cu++;
      free--;
    } else {
      cu++;
      r--;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
