func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, t;   int visited[30009];   bool ok = false;   vector<int> C[30009];   void dfs(int u) {     if (u == t) {       ok = true;       return;     }     visited[u] = 1;     if (C[u].size())       for (int i = 0; i <= C[u].size() - 1; i++) {         int v = C[u][i];         if (!visited[v] && v <= n) {           dfs(v);           if (ok) return;         }       }   }   int main() {     scanf( %d%d , &n, &t);     for (int i = 1; i <= n - 1; i++) {       int x;       scanf( %d , &x);       C[i].push_back(x + i);     }     dfs(1);     if (ok)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }   