#include <bits/stdc++.h>
using namespace std;
const int maxn = 5009;
bool f[maxn][maxn], vis[maxn];
int pre[maxn][maxn], a[maxn];
int n, k, v, sum, cnt;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void update(int x, int y, int opt) {
  f[x][y] = 1;
  pre[x][y] = opt;
}
int calc(int x) { return x / k + bool(x % k); }
void work(int x, int y) {
  if (x == 0) return;
  if (pre[x][y]) {
    vis[x] = 1;
    cnt++;
    sum += a[x];
    work(x - 1, (y - a[x] % k + k) % k);
  } else
    work(x - 1, y);
}
int main() {
  n = read();
  k = read();
  v = read();
  for (int i = 1; i <= n; i++) a[i] = read(), sum += a[i];
  if (sum < v) {
    puts("NO");
    return 0;
  }
  f[0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < k; j++)
      if (f[i][j]) {
        update(i + 1, j, 0);
        update(i + 1, (j + a[i + 1]) % k, 1);
      }
  int tmp;
  for (tmp = n; tmp; tmp--)
    if (f[tmp][v % k]) break;
  if (tmp == 0)
    puts("NO");
  else {
    puts("YES");
    work(tmp, v % k);
    if (cnt == 0 || cnt == n) {
      for (int i = 2; i <= n; i++) {
        if (calc(a[i])) printf("%d %d 1\n", calc(a[i]), i);
        a[1] += a[i];
      }
      if (cnt == 0 && v) printf("%d 1 2\n", v / k);
      if (cnt && a[1] - v) printf("%d 1 2\n", (a[1] - v) / k);
    } else {
      int L = 1, R = 1;
      for (; L <= n && !vis[L]; L++)
        ;
      for (; R <= n && vis[R]; R++)
        ;
      for (int i = 1; i <= n; i++)
        if (vis[i] && i != L) {
          if (calc(a[i])) printf("%d %d %d\n", calc(a[i]), i, L);
          a[L] += a[i];
        }
      for (int i = 1; i <= n; i++)
        if (!vis[i] && i != R) {
          if (calc(a[i])) printf("%d %d %d\n", calc(a[i]), i, R);
          a[R] += a[i];
        }
      if (a[L] > v)
        printf("%d %d %d\n", (a[L] - v) / k, L, R);
      else if (a[L] < v)
        printf("%d %d %d\n", (v - a[L]) / k, R, L);
    }
  }
  return 0;
}
