#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, t, i = 0, now = 0, a;
  cin >> n >> t;
  while (now < t - 1) {
    while (i <= now) {
      i++;
      cin >> a;
    }
    now += a;
  }
  now == t - 1 ? cout << "YES" : cout << "NO";
}
