#include<bits/stdc++.h>
using namespace std;
struct node{
int floor,step;
};
int n,a,t;
int k[201];
int b[201];
queue<node> q;
int main(){
cin>>n>>a>>t;
for (int i=1;i<=n;i++) cin>>k[i];
int step=0;
b[a]=1;
q.push((node){a,0});
while (!q.empty()){
int floor=q.front().floor;
int step=q.front().step;
b[floor]=1;
q.pop();
if (floor==t){
cout<<step<<endl;
return 0;
}
if (floor-k[floor]>=1 and b[floor-k[floor]]==0){
q.push((node){floor-k[floor],step+1});
}
if (floor+k[floor]<=n and b[floor+k[floor]]==0){
q.push((node){floor+k[floor],step+1});
}
}
cout<<-1<<endl;
return 0;
}