#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, t, b, y, start = 0, cek = false;
  cin >> a >> b;
  long long z[a + 1];
  z[0] = 1;
  z[a] = 1;
  for (t = 1; t < a; t++) {
    cin >> z[t];
  }
  for (t = 0; t < a + 1; t += y) {
    if (t == b) {
      cout << "YES" << endl;
      cek = true;
      break;
    }
    y = z[t];
  }
  if (cek == false) {
    cout << "NO" << endl;
  }
}
