#include <iostream>
#include <climits>
using namespace std;
int moves[205];
int vis[205];
int N, A, B;
long long res = 500;
void dfs(int x,long long time)
{
if (x != B and moves[x] == 0)
{
return;
}
if (x > N or x < 1)
{
return;
}
if (vis[x])
{
return;
}
if (x == B)
{
res = min(res, time);
return;
}
if (time >= res)
{
return;
}
vis[x] = 1;
dfs(x + moves[x], time + 1);
dfs(x - moves[x], time + 1);
vis[x] = 0;
}
int main()
{
cin >> N >> A >> B;
for (int i = 1; i <= N; i++)
{
cin >> moves[i];
}
dfs(A, 0);
if (res == 500)
{
cout << -1 << endl;
return 0;
}
cout << res << endl;
return 0;
}