#include<bits/stdc++.h>
using namespace std;
struct node{
int a,step1;
};
int n,b,a,k[201],ans;
bool w[201];
queue<node> q;
void bfs(){
q.push({b,0});
w[b]=1;
while(!q.empty()){
int xx,xstep;
xx=q.front().a;
xstep=q.front().step1;
//cout<<xx+k[xx]<<" "<<xx-k[xx]<<endl;
if(xx+k[xx]>=1&&xx+k[xx]<=n){
// cout<<endl;&&w[xx]==0
w[xx]=1;
q.push({xx+k[xx],xstep+1});
if(xx+k[xx]==a){
ans=xstep+1;
break;
}
}
if(xx-k[xx]>=1&&xx-k[xx]<=n){
// cout<<endl;&&w[xx]==0
w[xx]=1;
q.push({xx-k[xx],xstep+1});
if(xx-k[xx]==a){
ans=xstep+1;
break;
}
}
q.pop();
}
if(ans==0){
cout<<-1;
return;
}
else{
cout<<ans;
return;
}
}
int main(){
cin>>n>>b>>a;
for(int i=1;i<=n;i++)
{
cin>>k[i];
}
bfs();
}
/**************************************************************
Problem: 1819
User: wuyunfeng
Language: C++
Result: Time Limit Exceed
****************************************************************/