import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n = int(input().rstrip())
bridge = list(map(int, input().split()))
s = int(input().rstrip()) - 1 # 0-indexed로 변경
visited = [False] * n
cnt = 0
def dfs(x):
global cnt
visited[x] = True
cnt += 1
for direction in [1, -1]:
nx = x + direction * bridge[x]
if 0 <= nx < n and not visited[nx]:
dfs(nx)
dfs(s)
print(cnt)