#include <bits/stdc++.h>
using namespace std;
int cnt[3 * 100000];
void push(int &id_max) {
  while (!cnt[id_max]) --id_max;
}
int main() {
  int n, s;
  cin >> n >> s;
  int id_max = 0;
  int ans = 0;
  int cnt_mstk = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (i != s - 1) {
      if (x == 0) {
        ++cnt_mstk;
        ++ans;
      } else {
        cnt[x]++;
        id_max = max(id_max, x);
      }
    } else {
      cnt[0]++;
      if (x != 0) {
        ++ans;
      }
    }
  }
  for (int i = 1; i < id_max; ++i) {
    if (!cnt[i]) {
      if (cnt_mstk) {
        cnt[i] = 1;
        --cnt_mstk;
      } else {
        cnt[id_max]--;
        cnt[i] = 1;
        ++ans;
        push(id_max);
      }
    }
  }
  cout << ans << endl;
}
