#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i = 1, k, Max = 0;
  cin >> n >> k;
  long long int a[n + 1];
  a[0] = 1;
  for (int i = 1; i < n; i++) cin >> a[i];
  while (i < n) {
    a[i] += i;
    i = a[i];
    if (k == i) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}
