Jump Jump

Given jump distances on a row of n stones, count how many stones are reachable from a starting stone via left or right jumps that stay on the bridge.

Medium4GraphBFSArrayQueueInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Yeongwoo is a frog. Ribbit, ribbit, ribbit.

Yeongwoo stands on a stone bridge built from nn stones in a row. The stones are numbered 1, 2, and so on up to nn from the left, and each stone has one number written on it. If the number on stone ii is AiA_i, Yeongwoo can jump from stone ii to stone iAii - A_i, which is AiA_i places to the left, or to stone i+Aii + A_i, which is AiA_i places to the right. He cannot leave the bridge, so a jump whose destination number is smaller than 1 or larger than nn is not available.

A stone is visitable if Yeongwoo can land on it after some number of jumps from the starting stone. The starting stone also counts as visitable.

Given the starting stone, find how many stones Yeongwoo can visit.

Input

The first line contains the number of stones nn. (1n1000001 \le n \le 100000)

The second line contains the jump distances A1,A2,,AnA_1, A_2, \dots, A_n, separated by spaces. (1Ai1000001 \le A_i \le 100000)

The third line contains the starting stone ss. (1sn1 \le s \le n)

Output

Print the number of stones Yeongwoo can visit on the first line.