#include <bits/stdc++.h>
using namespace std;
int n,p,l,r;
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>p>>l>>r;
vector<int> map(n,-1);
map[0]=0;
vector<int> s(n);
for(int i=0;i<n;i++){
cin>>s[i];
}
queue<pair<int,int>>q;
q.push(make_pair(0,0));
while(!q.empty()){
int now=q.front().first;
int t=q.front().second;
q.pop();
if(now==p){
break;
}
if(now+r<n&&map[s[now+r]]==-1){
q.push(make_pair(s[now+r],t+1));
map[s[now+r]]=t+1;
}
if(now-l>0&&map[s[now-l]]==-1){
q.push(make_pair(s[now-l],t+1));
map[s[now-l]]=t+1;
}
}
cout<<map[p];
}