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