#include <bits/stdc++.h>
using namespace std;
const int maxn=1e7+14;
int n, p, q, chan[maxn], le[maxn];
void solve(){
cin >> n >> p >> q;
memset(chan, 0, sizeof chan);
memset(le, 0, sizeof le);
for (int i = 1; i <= n; i++){
int x;
cin >> x;
if (x % 2) le[i] = 1;
else chan[i] = 1;
}
if ( !p && !q) {
cout << 1 ;
return;
}
int cntchan = 0, cntle = 0;
for (int i = 1; i <= n; i++) {
cntchan += chan[i];
cntle += le[i];
}
if (cntchan < p || cntle < q) {
cout << -1;
return;
}
int ans = n;
int l = 1, r = 1, cntp = 0, cntq = 0;
while (r <= n) {
while ((cntp < p || cntq < q) && r <= n) {
cntp += chan[r];
cntq += le[r];
r++;
}
while (cntp >= p && cntq >= q && l <= r) {
cntp -= chan[l];
cntq -= le[l];
l++;
}
l --;
cntp += chan[l];
cntq += le[l];
if (cntp >= p && cntq >= q) {
ans = min(ans, r - l);
}
cntp -= chan[l];
cntq -= le[l];
l++;
}
cout << ans ;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen("input.txt","r")){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
}
solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBtYXhuPTFlNysxNDsKaW50IG4sIHAsIHEsIGNoYW5bbWF4bl0sIGxlW21heG5dOwp2b2lkIHNvbHZlKCl7CgljaW4gPj4gbiA+PiBwID4+IHE7CgltZW1zZXQoY2hhbiwgMCwgc2l6ZW9mIGNoYW4pOwoJbWVtc2V0KGxlLCAwLCBzaXplb2YgbGUpOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKXsKCQlpbnQgeDsKCQljaW4gPj4geDsKCQlpZiAoeCAlIDIpIGxlW2ldID0gMTsKCQllbHNlIGNoYW5baV0gPSAxOwoJfQoJCglpZiAoICFwICYmICFxKSB7CgkJY291dCA8PCAxIDs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