#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int n, k, v, a[N], f[N][N], g[N][N], i, j, s, b[N], x, y, xb;
bool vi[N];
int main() {
  cin.tie(0), cin.sync_with_stdio(false);
  cin >> n >> k >> v;
  f[0][0] = -1;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    s += a[i];
    memcpy(f[i], f[i - 1], k << 2);
    memcpy(g[i], g[i - 1], k << 2);
    for (j = 0; j < k; ++j) {
      y = (j + a[i]) % k;
      if (f[i - 1][j] && g[i - 1][j] + a[i] > g[i][y])
        f[i][y] = i, g[i][y] = g[i - 1][j] + a[i];
    }
  }
  if (n == 1) {
    if (a[1] == v)
      cout << "YES\n";
    else
      cout << "NO\n";
    return 0;
  }
  if (!f[n][v % k] || s < v) {
    cout << "NO" << '\n';
    return 0;
  }
  cout << "YES" << '\n';
  if (v % k == 0) {
    for (i = 2; i <= n; ++i)
      if (a[i]) cout << (a[i] - 1) / k + 1 << ' ' << i << " 1\n";
    if (v) cout << v / k << " 1 2 \n";
    return 0;
  }
  for (i = n, x = v % k; i; --i) {
    y = (x - a[i] % k + k) % k;
    if (f[i][x] == i) x = y, b[++xb] = i, vi[i] = 1;
  }
  for (i = 1; i < xb; ++i) {
    cout << (a[b[i]] - 1) / k + 1 << ' ' << b[i] << ' ' << b[xb] << '\n';
    a[b[xb]] += a[b[i]];
  }
  int j = 0;
  for (i = 1; i <= n; ++i) {
    if (!vi[i] && a[b[xb]] < v) {
      if (!j)
        j = i;
      else
        cout << (a[i] - 1) / k + 1 << ' ' << i << ' ' << j << '\n',
            a[j] += a[i];
    }
  }
  if (j) cout << a[j] / k << ' ' << j << ' ' << b[xb] << '\n';
  for (i = 1; i <= n; ++i)
    if (b[xb] != i) break;
  if (a[b[xb]] > v)
    cout << (a[b[xb]] - v) / k << ' ' << b[xb] << ' ' << i << '\n';
  return 0;
}
