#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll infll = 1e18;

template<typename T>
istream& operator>>(istream& is, vector<T>& a) {
	for (auto& i : a) {
		is >> i;
	}
	return is;
}

mt19937 rng(228);

int32_t main() {
#ifdef LOCAL
	assert(freopen("C:\\Users\\User\\input.txt", "r", stdin));
#else
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
#endif
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	cin >> a;
	map<int, int> mp;
	for (auto i : a) {
		++mp[i];
	}
	ll ans = 0;
	for (int i = 0; i < k - 1; ++i) {
		ans += a[i] + 1;
	}
	ans += a[k - 1] + mp[k - 1];
	cout << ans << "\n";
	return 0;
}