#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 5e3 + 10;
int n, k;
int a[maxn];
int pre[maxn][maxn];
bool ok[maxn][maxn];
bool ne[maxn];
void get(int i, int v) {
  if (!i) return;
  if (pre[i][v] == v && ok[i - 1][v]) {
    get(i - 1, v);
  } else {
    ne[i] = 1;
    get(i - 1, pre[i][v]);
  }
}
bool solve() {
  int v;
  cin >> n >> k >> v;
  int sum = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i], sum += a[i];
  if (sum < v) return false;
  if (v % k == 0) {
    printf("YES\n");
    for (int i = 2; i <= n; ++i)
      if (a[i]) printf("%d %d %d\n", (a[i] + k - 1) / k, i, 1);
    if (v != 0) printf("%d %d %d", v / k, 1, 2);
    return true;
  }
  ok[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < k; ++j)
      if (ok[i - 1][j]) {
        pre[i][j] = j;
        ok[i][j] = 1;
        pre[i][(j + a[i]) % k] = j;
        ok[i][(j + a[i]) % k] = 1;
      }
  }
  if (!ok[n][v % k]) return false;
  get(n, v % k);
  int s, t = 2;
  for (int i = 1; i <= n; ++i)
    if (ne[i]) {
      s = i;
      break;
    }
  for (int i = 1; i <= n; ++i)
    if (!ne[i]) {
      t = i;
      break;
    }
  printf("YES\n");
  for (int i = 1; i <= n; ++i)
    if (a[i])
      if (ne[i] && i != s) {
        printf("%d %d %d\n", (a[i] + k - 1) / k, i, s);
        a[s] += a[i];
      }
  if (a[s] == v) return true;
  if (a[s] > v) {
    int g = a[s] - v;
    printf("%d %d %d\n", g / k, s, t);
    return true;
  } else {
    for (int i = 1; i <= n; ++i)
      if (a[i])
        if (!ne[i] && i != t) {
          printf("%d %d %d\n", (a[i] + k - 1) / k, i, t);
          a[t] += a[i];
        }
    int g = v - a[s];
    printf("%d %d %d\n", g / k, t, s);
    return true;
  }
}
int main() {
  if (!solve()) cout << "NO";
  return 0;
}
