#include<bits/stdc++.h>
using namespace std;
long long a,f,e,cs=-1;
int b[300][2];
void check(int x,int y){
if(x==e){
cs=y;
return ;
}
if(cs!=-1||b[x][1]==1||x<=0)return ;
b[x][1]=1;
check(x+b[x][0],y+1);
check(x-b[x][0],y+1);
}
int main(){
cin>>a>>f>>e;
for(int i=1;i<=a;i++){
cin>>b[i][0];
b[i][1]=0;
}
check(f,0);
cout<<cs;
}