#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
// freopen("in.txt","r",stdin);
int n,r,t,cnt=0;
cin>>n>>r;
for (int i = 0; i <= n; cin>>t, ++i)
if(t)
cnt++;
if(!cnt){cout<<"-1"<<endl;return 0;}
t = ceil((double)n/(2*r-2));
t = (n>0)?t:1;
t = (t<=cnt)?t:-1;
cout<<(t)<<endl;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwoJY2luLnRpZSgwKTsKLy8JZnJlb3BlbigiaW4udHh0IiwiciIsc3RkaW4pOwoJaW50IG4scix0LGNudD0wOwoJY2luPj5uPj5yOwoJZm9yIChpbnQgaSA9IDA7IGkgPD0gbjsgY2luPj50LCArK2kpCgkJaWYodCkKCQkJY250Kys7CgoJaWYoIWNudCl7Y291dDw8Ii0xIjw8ZW5kbDtyZXR1cm4gMDt9CgkJCgl0ID0gY2VpbCgoZG91YmxlKW4vKDIqci0yKSk7IAoJdCA9IChuPjApP3Q6MTsKCQoJdCA9ICh0PD1jbnQpP3Q6LTE7Cgljb3V0PDwodCk8PGVuZGw7CgkKIApyZXR1cm4gMDsKfQoKCg==