#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; i++) cin >> v[i];
  int t = 1;
  bool flag = 0;
  while (t <= n) {
    t += v[t];
    if (t == k) {
      flag = 1;
      break;
    } else if (t > k)
      break;
  }
  if (flag)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
