#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int SIZE = 1e6 + 5;
const long long INF = 1LL << 60;
const double eps = 1e-4;
const double PI = 3.1415926535897932;
set<int> donthave;
int a[200009];
multiset<int> v;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  k--;
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &(a[i]));
  }
  int ans = 0;
  if (a[k] != 0) {
    a[k] = 0;
    ans++;
  }
  for (int i = (1); i < (200002); ++i) donthave.insert(i);
  for (int i = 0; i < (n); ++i) {
    if (donthave.find(a[i]) != donthave.end()) donthave.erase(a[i]);
  }
  for (int i = 0; i < (n); ++i) {
    if (i == k) continue;
    if (a[i] == 0) {
      a[i] = *donthave.begin();
      donthave.erase(donthave.begin());
      ans++;
    }
  }
  for (int i = 0; i < (n); ++i) v.insert(a[i]);
  while (*v.rbegin() + 1 > *donthave.begin()) {
    ans++;
    v.erase(v.find(*v.rbegin()));
    v.insert(*donthave.begin());
    donthave.erase(donthave.begin());
  }
  printf("%d", ans);
}
