#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, a;
  scanf("%d %d", &n, &t);
  int curr = 1;
  int i = 0;
  while (curr < t) {
    i++;
    scanf("%d", &a);
    if (i != curr) continue;
    curr += a;
  }
  if (curr == t)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
