#include<bits/stdc++.h>
using namespace std;
const int N=205;
int n,m,a,b,minn=0;
int mp[N];
bool vis[N];
struct node
{
int x,step;
}now;
void dfs()
{
queue<node>que;
node str;
str.x=a;
str.step=0;
que.push(str);
vis[a]=true;
while(!que.empty())
{
now=que.front();
que.pop();
node next;
if(now.x==b)
break;
next.x=now.x+mp[now.x];
if(next.x<=n&&!vis[next.x])
{
next.step+=1;
vis[next.x]=true;
que.push(next);
}
next.x=now.x-mp[now.x];
if(next.x>=1&&!vis[next.x])
{
next.step+=1;
vis[next.x]=true;
que.push(next);
}
}
if(now.x==b)
cout<<now.step;
else
cout<<"-1";
}
int main()
{
cin>>n>>a>>b;
for(int i=1;i<=n;i++)
cin>>mp[i];
dfs();
return 0;
}