#include <cstdio>
#include <queue>
using namespace std;
struct ele
{
int floor;
int step;
};
queue<ele> q;
int main()
{
int a, b, n;
int k[202];
int DaBiao[202] = {0};
scanf("%d %d %d", &a, &b, &n);
ele A;
A.floor = a;
A.step = 0;
for(int i = 1; i <= n; i++)
scanf("%d", &k[i]);
q.push(A);
DaBiao[a] = 1;
while(q.size())
{
if(q.front().floor == b)
break;
if(!DaBiao[q.front().floor])
{
ele zancun_1;
ele zancun_2;
zancun_1.step = q.front().step + 1;
zancun_2.step = q.front().step + 1;
if(q.front().floor + k[q.front().floor + 1] >= 0)
{
zancun_1.floor = q.front().floor + k[q.front().floor + 1];
DaBiao[q.front().floor] = 1;
q.push(zancun_1);
}
if(q.front().floor - k[q.front().step + 1] >= 0)
{
zancun_2.floor = q.front().floor + k[q.front().floor + 1];
DaBiao[q.front().floor] = 1;
q.push(zancun_2);
}
else
DaBiao[q.front().floor] = 0;
q.pop();
}
}
printf("%d", q.back().step);
return 0;
}