#include<bits/stdc++.h>
using namespace std;
signed main() {
long long n, f, t;
cin >> n >> f >> t;
long long a[n + 1];
long long sum = 0;
bool tr = true;
for (long long i = 1; i <= n; i++) {
cin >> a[i];
sum += a[i];
if (a[i] > 1) tr = false;
}
if (sum < t) {
cout << "NO\n";
return 0;
}
if (n <= 2) {
if (f == 1) {
if (a[1] >= t) cout << 0 << "\n";
else if (n == 2 && a[2] >= t) cout << 1 << "\n";
else cout << "NO\n";
}
else if (f == 2) {
if (a[1] + a[2] >= t) cout << 0 << "\n";
else cout << "NO\n";
}
}
else if (tr) {
long long icerideki_birler = 0;
vector<long long> disaridaki_bir_indeksleri;
for (long long i = 1; i <= n; i++) {
if (i <= f) {
if (a[i] == 1) icerideki_birler++;
} else {
if (a[i] == 1) disaridaki_bir_indeksleri.push_back(i);
}
}
if (icerideki_birler >= t) {
cout << 0 << "\n";
} else {
long long gereken = t - icerideki_birler;
long long toplam_hamle = 0;
for (int i = 0; i < gereken; i++) {
toplam_hamle += (disaridaki_bir_indeksleri[i] - (f));
f++;
}
cout << toplam_hamle << "\n";
}
}
return 0;
}