#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
VI vec[5050];
int main() {
  vector<pair<int, pair<int, int>>> ans;
  int n, k, v;
  cin >> n >> k >> v;
  VI a(n), b(max(n, k), 0), c, d;
  for (auto &r : a) cin >> r;
  function<void(int, int)> move = [&](int i, int j) {
    int times = (a[i] + k - 1) / k;
    a[j] += min(a[i], times * k);
    a[i] = max(0, a[i] - times * k);
    if (times) ans.push_back({times, {i, j}});
  };
  b[0] = 1;
  if (v % k == 0) {
    move(0, 1);
    c.push_back(0);
  } else {
    for (int i = 0; !b[v % k] && i < n; i++) {
      VI current;
      for (int j = 0, r; j < k; j++)
        if (b[j] && !b[r = (j + a[i]) % k]) {
          current.push_back(r);
          vec[r] = vec[j];
          vec[r].push_back(i);
        }
      for (auto &r : current) b[r] = 1;
    }
  }
  if (!b[v % k])
    return puts("NO"), 0;
  else if (c.empty())
    c = vec[v % k];
  for (auto &r : c) b[r] = 5;
  for (int i = 0; i < n; i++)
    if (b[i] != 5) d.push_back(i);
  for (int i = 1; i < c.size(); i++) move(c[i], c[0]);
  for (int i = 1; i < d.size(); i++) move(d[i], d[0]);
  int more = d.empty() ? 0 : a[d[0]];
  if (a[c[0]] + more < v) return puts("NO"), 0;
  if (a[c[0]] > v) {
    if (d.empty()) d.push_back(c[1]);
    int cnt = (a[c[0]] - v) / k;
    ans.push_back({cnt, {c[0], d[0]}});
    a[c[0]] = v;
  }
  if (a[c[0]] < v) {
    int cnt = (v - a[c[0]]) / k;
    ans.push_back({cnt, {d[0], c[0]}});
    a[c[0]] = v;
  }
  puts("YES");
  for (auto &r : ans)
    cout << r.first << ' ' << r.second.first + 1 << ' ' << r.second.second + 1
         << endl;
  return 0;
}
