#include<iostream>
using namespace std;
int n, a, b;
int map[201];
int book[201];
int mins=99999;
void dfs(int x,int step)
{
if (x == b)
{
if (mins > step)mins = step;
return;
}
int xt;
int move[2] = { map[x],-map[x] };
for (int i = 0; i < 2; i++)
{
xt = x + move[i];
if (xt <= 0 || xt > n || book[xt])
continue;
book[xt] = 1;
dfs(xt, step + 1);
book[xt] = 0;
}
return;
}
int main()
{
cin >> n >> a >> b;
for (int i = 1; i <= n; i++)
cin >> map[i];
dfs(a, 0);
if (mins == 99999)cout << -1;
else cout << mins;
}