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