#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve2() {
  string s;
  vector<string> v1;
  cin >> s;
  if (s == "cd") {
    cin >> s;
  }
  cout << "Day la s tren: " << s << "\n";
  if (s == "pwd") {
    if (!v1.empty()) {
      for (int i = 0; i < v1.size(); i++) {
        cout << v1.at(i) << "/";
      }
    } else {
      cout << "/"
           << "\n";
    }
    cout << "\n";
    return;
  } else {
    cout << "Day la s: " << s << "\n";
    string s2 = "";
    for (int i = 1; i < s.length(); i++) {
      if (s[i] == '.') {
        i += 3;
        v1.pop_back();
        s2 = "";
      }
      if (s[i] == '/' || i == s.length()) {
        string alert = "";
        if (s2 != "") {
          cout << "Day la s2 truoc khi push back tren: " << s2 << "\n";
          for (int jj = 0; jj < v1.size(); jj++) {
            if (s2 == v1.at(jj)) {
              alert = "Co";
            }
          }
          if (alert == "") {
            cout << "Day la s2 truoc khi push back: " << s2 << "\n";
            v1.push_back(s2);
            s2 = "";
          } else {
            s2 = "";
          }
        } else {
          continue;
        }
      } else {
        s2 += s[i];
        cout << "Day la s2: " << s2 << "\n";
      }
    }
  }
}
vector<int> graph[100010];
bool vis[100010];
void solve4(int node) {
  vis[node] = 1;
  cout << "Day la vis: " << vis[node] << "\n";
  for (int i = 0; i < graph[node].size(); i++) {
    cout << "Day la node: " << node << "\n";
    cout << "Day la graph[node].size(): " << graph[node].size() << "\n";
    int next = graph[node][i];
    cout << "Day la next: " << next << '\n';
    if (vis[next] == 0) {
      cout << "Day la next trong if: " << next << '\n';
      solve4(next);
    }
  }
}
int main() {
  int n, t;
  cin >> n >> t;
  vector<int> v1(n);
  v1.at(0) = 1;
  for (int i = 1; i < n; i++) {
    cin >> v1.at(i);
  }
  int find = 1;
  for (int jj = 1; jj < n; jj++) {
    find += v1.at(jj);
    if (find == t) {
      cout << "YES"
           << "\n";
      break;
    }
    if (find > t) {
      cout << "NO"
           << "\n";
      break;
    }
    jj = find - 1;
    find == jj;
  }
}
