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*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n* - 1</sub>. For every integer *i* where 1 ≤ *i* ≤ *n* - 1 the condition 1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ *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*<sub class="lower-index">*i*</sub>), and one can travel from cell *i* to cell (*i* + *a*<sub class="lower-index">*i*</sub>) using the *i*-th portal. Unfortunately, one cannot use the portal backwards, which means one cannot move from cell (*i* + *a*<sub class="lower-index">*i*</sub>) to cell *i* using the *i*-th portal. It is easy to see that because of condition 1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ *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.
The first line contains two space-separated integers *n* (3 ≤ *n* ≤ 3 × 10<sup class="upper-index">4</sup>) 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*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n* - 1</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ *n* - *i*). It is guaranteed, that using the given transportation system, one cannot leave the Line World.
class Graph:
    def __init__(self, nodes, edges):
        self.nodes = nodes
        self.edges = edges

    def adjacent(self, node):
        adj_nodes = []
        for edge in self.edges:
            if edge[0] == node:
                adj_nodes.append(edge[1])
        return adj_nodes

    def get_graph(self):
        return self.nodes, self.edges

class Stack:
    def __init__(self):
        self.items = []

    def isEmpty(self):
        return len(self.items) == 0

    def push(self, item):
        self.items.append(item)

    def pop(self):
        if self.isEmpty():
            raise Exception("Stack is empty")
        return self.items.pop()

    def peek(self):
        if self.isEmpty():
            raise Exception("Stack is empty")
        return self.items[-1]

    def size(self):
        return len(self.items)


def graphDFS(G, start, goal):

    stack = Stack() #creamos el stack vacio
    visited = set() #creamos el conjunto de visitados vacio
    stack.push(start) #paso 0: meter start en el stack

    while not stack.isEmpty(): #paso 1: mirar que no este vacio
        current = stack.pop() #paso 2: coger la cabeza y guardarla en current
        visited.add(current) #paso 3: marcar current como visitado

        if current == goal: #paso 4: mirar si es el objetivo
            return True #termina
        for v in G.adjacent(current): # paso 5: iterar por todos los  adyacentes a current
            if not v in visited: #miro si no lo he visitado
                stack.push(v) #si no lo he visitado lo meto al stack
    #paso 6: repetir
    return False #si nunca pude llegar a goal no existe el camino.


def main():
    n = int(input("Ingresa n"))
    t = int(input("Ingresa t"))
    lista_a = []
    for i in range(1,n): #1 es donde empieza y si lo toma y n donde termina pero toma el anterior y no lo toma (n-1)
        temp = int(input("ingresa a"+str(i))) #pide los a sub i actual
        lista_a.append(temp)
    nodes = []
    for i in range(1,n+1):
        nodes.append(i)
    edges = []
    for i in range(n-1):
        pareja = (i+1,lista_a[i]+i+1) #hace la lista de las parejas del grafo
        print(i, pareja)
        edges.append(pareja)
    print(edges)


    g = Graph(nodes, edges)  # constructor de un grafo que recibe la lista de nodes y de vertices
    start = 1
    goal = t

    path_exists = graphDFS(g, start, goal)  # booleano que representa el resultado de la dfs true si existe camino
    if path_exists:
        print("YES")
    else:
        print("NO")

if __name__ == '__main__':
    main()