#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t;     cin >> n >> t;     int f = 0;     int x;     int sum = 1;     for (int i = 1; i < n; i++) {       cin >> x;       if (i == sum) sum += x;       if (sum == t) f = 1;     }     if (f == 1)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }   