#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, s;
int a[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> s;
  int count = 0;
  int temp;
  int j = -1;
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    if (i == s) {
      if (temp != 0) count++;
    } else
      a[++j] = temp > 0 ? temp : maxn;
  }
  sort(a, a + j + 1);
  int start = 0, end = j, num = 1;
  bool flag = false;
  while (start <= end) {
    flag = false;
    while (a[start] == num) {
      flag = true;
      start++;
    }
    if (!flag) {
      count++;
      end--;
    }
    num++;
  }
  cout << count << endl;
  return 0;
}
