New Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty of escaping the cell. People wanted to meet people who live in other cells.

So, user tncks0121 has made a transportation system to move between these cells, to celebrate the New Year. First, he thought of n - 1 positive integers a_1, a_2, ..., a_{n} - 1. For every integer i where 1 ≤ i ≤ n - 1 the condition 1 ≤ a_{i} ≤ n - i holds. Next, he made n - 1 portals, numbered by integers from 1 to n - 1. The i-th (1 ≤ i ≤ n - 1) portal connects cell i and cell (i + a_{i}), and one can travel from cell i to cell (i + a_{i}) using the i-th portal. Unfortunately, one cannot use the portal backwards, which means one cannot move from cell (i + a_{i}) to cell i using the i-th portal. It is easy to see that because of condition 1 ≤ a_{i} ≤ n - i one can't leave the Line World using portals.

Currently, I am standing at cell 1, and I want to go to cell t. However, I don't know whether it is possible to go there. Please determine whether I can go to cell t by only using the construted transportation system.


-----Input-----

The first line contains two space-separated integers n (3 ≤ n ≤ 3 × 10^4) and t (2 ≤ t ≤ n) — the number of cells, and the index of the cell which I want to go to.

The second line contains n - 1 space-separated integers a_1, a_2, ..., a_{n} - 1 (1 ≤ a_{i} ≤ n - i). It is guaranteed, that using the given transportation system, one cannot leave the Line World.


-----Output-----

If I can go to cell t using the transportation system, print "YES". Otherwise, print "NO".


-----Examples-----
Input
8 4
1 2 1 2 1 2 1

Output
YES

Input
8 5
1 2 1 2 1 1 1

Output
NO



-----Note-----

In the first sample, the visited cells are: 1, 2, 4; so we can successfully visit the cell 4.

In the second sample, the possible cells to visit are: 1, 2, 4, 6, 7, 8; so we can't visit the cell 5, which we want to visit.

Difficulty: interview

Starter code:

Solutions:
"""
Codeforces Contest Good Bye 2014 Contest Problem A

Author  : chaotic_iak
Language: Python 3.4.2
"""

################################################### SOLUTION

def main():
    n,t = read()
    a = read()
    c = 1
    while c < t:
        c += a[c-1]
    if c == t:
        print("YES")
    else:
        print("NO")

#################################################### HELPERS



def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0: return inputs
    if mode == 1: return inputs.split()
    if mode == 2: return list(map(int, inputs.split()))

def write(s="\n"):
    if s is None: s = ""
    if isinstance(s, list): s = " ".join(map(str, s))
    s = str(s)
    print(s, end="")

write(main())

n, t = map(int, input().split())
arr = list(map(int, input().split()))
cur = 0
was = False
while cur < n:
	try:
		cur = cur+arr[cur]
		if(cur == t-1):
			was = True
	except:
		break
if(was):
	print('YES')
else:
	print('NO')

n, t = map(int, input().split())
a, cur = [0] + [int(x) for x in input().split()], 1
while cur < t:
    cur += a[cur]
print('YES' if cur == t else 'NO')

n,t=map(int,input().split())
a=list(map(int,input().split()))
can=[0 for _ in range(n)]
can[0]=1
for i in range(n-1):
  if can[i]:
    can[i+a[i]] = 1
print("YES" if can[t-1] else "NO")

n, t = [int(_) for _ in input().split()]
a = [int(_) for _ in input().split()]
p = 1
while p < t:
    p += a[p-1]
if p == t:
    print("YES")
else:
    print("NO")


#input
n,t=map(int,input().split())
a=[int(x) for x in input().split()]

#variables
p=1

#main
while p<=t:
	if p==t:
		print('YES')
		quit()
	p+=a[p-1]

#output
print('NO')

n,t = list(map(int, input().split()))
l = input().split()
for i in range(n-1):
    l[i] = int(l[i])
l = [0]+l
now = 1
while 1:
    now += l[now]
    if now > t:
        ans = 0
        break
    if now == t:
        ans = 1
        break

if ans == 0:
    print("NO")
else:
    print("YES")


n,m=input().split(' ')
n=int(n)
m=int(m)
seq=[1]
a=input()
line=a.split(' ')
c=1
while c!=n:
    c+=int(line[c-1])
    seq.append(c)
if m in seq:
    print("YES")
else:
    print("NO")

line = input().split()
n = int(line[0])
t = int(line[1])

line = input().split()
arr = [int(num) for num in line]
n = 0
while n < t - 1:
    n += arr[n]

if n == t - 1:
    print('YES')
else:
    print('NO')


import sys

nums = [int(x) for x in sys.stdin.readline().split(" ")]
a = [int(x) for x in sys.stdin.readline().split(" ")]

t = nums[1]

curr = 1
while curr < t:
	curr += a[curr-1]
if curr == t:
	print("YES")
else:
	print("NO")

__author__ = 'Rakshak.R.Hegde'
"""
Created on Dec 30 2014 PM 08:30

@author: Rakshak.R.Hegde
"""


def mint(): return map(int, input().split())


n, t = mint()
a = list(mint())
curr = 1
while curr < t:
    curr = curr + a[curr - 1]
print('YES' if curr == t else 'NO')

import sys

def main():
    n,t = tuple([int(y) for y in input().split()])
    a = [int(x) for x in input().split()]
    c = 1
    while True:
        c = c + a[c - 1]
        if c == t:
            print("YES")
            return
        elif c > t:
            print("NO")
            return
    print("NO")

def __starting_point():
    main()

__starting_point()

__author__ = 'Daniil'
n,t = list(map(int,input().split()))

a = list(map(int,input().split()))
i=0
while i!=t-1:
    i+=a[i]
    if i>t-1:
        print('NO')
        quit()
print('YES')


def ans():
    n, t= [int(i) for i in input().split()]
    a= [0]
    a+= [int(i) for i in input().split()]
    #print(a)
    
    ans= 1
    i= 1
    while True:
        ans+= a[i]
        i= ans
        if ans== t:
            print("YES")
            return
        
        if i> t:
            print("NO")
            return

ans()

n, t = (int(i) for i in input().split())
portals = [int(i) for i in input().split()]
home = 1
while True:
    if home == t:
        print('YES')
        break
    elif home > t:
        print('NO')
        break
    home += portals[home-1]


n, t = map(int, input().split())
a = list(map(int, input().split()))
pos = 1
while (pos < t): pos += a[pos-1]
print(('NO', 'YES')[pos == t])

n, t = list(map(int, input().split()))
t = t - 1
j = [int(x) for x in input().split()]

cur = 0
while True:
    if cur > t:
        print('NO')
        break
    cur += j[cur]
    if cur == t:
        print('YES')
        break


n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
current = 1
while current < t:
    current = current + a[current-1]
    
if current == t:
    print('YES')
else:
    print('NO')


n, t = list(map(int, input().split()))
a = list(map(int, input().split()))

current = 0

while current < t - 1:
    current = a[current] + current

print('YES' if current == t - 1 else 'NO')


def main():
	n, t = list(map(int, input().split()))	
	a =[0] + list(map(int, input().split())) + [100000]
	d = {}
	for i in range(1,n):
		d[i] = i + a[i]
	reached = True
	i = 1
	count = 1
	while reached and count <= 100009:
		if i in d:
			if d[i] == t:
				print ('YES')
				return
			i = d[i]
			count += 1
		else:
			break
	print('NO')



	

def __starting_point():
	main()

__starting_point()

c = input().split()
n = int(c[0])  # ���������� �����
t = int(c[1])  # ����� ������
c = input().split()  # �������

for i in range(n-1):
    c[i] = int(c[i])
    
a = 1
while (a < n) and (a < t):
    a += c[a-1]
    
if a == t:
    print('YES')
else:
    print('NO')

import math,string,itertools,fractions,heapq,collections,re,array,bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict


def main(n,t,a):
    j = 1
    while j<n:
        #print(j,a[j-1])
        j += a[j-1]
        if j==t:
            print("YES")
            return
    print("NO")



def main_input():
    n,t = list(map(int,input().split()))
    a = list(map(int,input().split()))
    main(n,t,a)

def __starting_point():
    main_input()

__starting_point()

n, t = input().rsplit(' ')
n, t = int(n), int(t)
lineWorld = [int(x) for x in input().rsplit(' ')]
start = 1
while start < t and start < n:
    oldStart = start
    start += lineWorld[start - 1]
    if start == oldStart:
        break
if start == t:
    print('YES')
else:
    print('NO')

n, t = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
now = 0
result = 0
while now < n - 1:
    now += a[now]
    if now + 1 == t:
        result = 1
if result:
    print('YES')
else:
    print('NO')