#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1e9) + 7;
const long double EPS = 0.0000001;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int pa;
  cin >> pa;
  deque<int> arr;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == pa - 1) {
      if (x != 0) {
        x = 0;
        ans++;
      }
    }
    arr.push_back(x);
  }
  sort(arr.begin(), arr.end());
  arr.pop_front();
  int cur = 0;
  while (arr.front() == 0) {
    arr.pop_front();
    arr.push_back(INT_MAX);
  }
  while (arr.size()) {
    cur++;
    int x = arr.front();
    if (x == cur) {
      while (arr.size() && arr.front() == cur) arr.pop_front();
      continue;
    }
    while (arr.size()) {
      x = arr.front();
      if (cur == x) {
        cur--;
        break;
      }
      arr.pop_back();
      cur++;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
