#include <bits/stdc++.h>
using namespace std;
int n, k, v, a[5001];
int ls[5001][5001];
const int inf = (int)1e9;
vector<pair<pair<long long int, long long int>, long long int> > ans;
void print() {
  cout << "YES\n";
  for (auto xp : ans)
    cout << xp.first.first << " " << xp.first.second << " " << xp.second
         << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> v;
  for (long long int i = 1; i <= n; ++i) cin >> a[i];
  if (!v) {
    cout << "YES\n";
    cout << inf << " 1 2\n";
    return 0;
  }
  if (v % k == 0) {
    int tot = a[1];
    for (long long int i = 2; i <= n; ++i)
      tot += a[i], ans.push_back(make_pair(make_pair(inf, i), 1LL));
    if (tot < v) {
      cout << "NO\n";
      return 0;
    }
    print();
    cout << (v / k) << " " << 1 << " " << 2 << '\n';
    return 0;
  }
  for (long long int i = 0; i <= k - 1; ++i) ls[1][i] = -1;
  ls[1][a[1] % k] = 1;
  for (long long int i = 2; i <= n; ++i)
    for (long long int sum = 0; sum <= k - 1; ++sum) {
      if (sum == a[i] % k) {
        ls[i][sum] = i;
        continue;
      }
      ls[i][sum] = ls[i - 1][sum];
      int req = ((sum - (a[i] % k)) + k) % k;
      if (ls[i - 1][req] != -1) ls[i][sum] = i;
    }
  if (ls[n][v % k] == -1) {
    cout << "NO\n";
    return 0;
  }
  vector<long long int> cur;
  long long int st = n, csum = v % k;
  while (1) {
    cur.push_back(ls[st][csum]);
    int ps = ls[st][csum];
    csum = ((csum - (a[ps] % k)) % k + k) % k;
    if (!csum) break;
    st = ps - 1;
  }
  int tot = a[cur[0]];
  int vv = cur[0];
  for (long long int i = 1; i <= (int)cur.size() - 1; ++i) {
    tot += a[cur[i]];
    ans.push_back(make_pair(make_pair(inf, cur[i]), cur[0]));
  }
  if (tot == v) {
    print();
    ;
    return 0;
  }
  if (tot > v) {
    int pr = cur[0] + 1;
    if (pr > n) pr -= 2;
    print();
    cout << (tot - v) / k << " " << cur[0] << " " << pr << '\n';
  } else {
    sort(cur.begin(), cur.end());
    vector<long long int> rem;
    for (long long int i = 1; i <= n; ++i)
      if (binary_search(cur.begin(), cur.end(), i) == false) rem.push_back(i);
    if (rem.empty()) {
      cout << "NO\n";
      return 0;
    }
    int ctot = a[rem[0]];
    for (long long int i = 1; i <= (int)rem.size() - 1; ++i) {
      ctot += a[rem[i]];
      ans.push_back(make_pair(make_pair(inf, rem[i]), rem[0]));
    }
    int req = (v - tot);
    if (ctot < req) {
      cout << "NO\n";
      return 0;
    }
    print();
    cout << req / k << " " << rem[0] << " " << vv << '\n';
  }
}
