#include <bits/stdc++.h>
using namespace std;
int n, m, q, cnt, ans, x[5010], y[5010], a1[5010], a2[5010], a3[5010];
bool f[5010][5010], p[5010];
int main() {
  int i, s, a, b, j, k;
  int c1, c2;
  scanf("%d%d%d", &n, &m, &q);
  f[0][0] = 1;
  for (i = 1; i <= n; i++) {
    scanf("%d", &x[i]);
    y[i] = x[i] % m;
    for (s = 0; s < m; s++)
      f[i][s] = f[i - 1][s] | f[i - 1][(s - y[i] + m) % m];
  }
  if (!f[n][q % m]) {
    printf("NO");
    return 0;
  }
  for (i = n, k = q % m; i; i--) {
    if (!x[i]) continue;
    if (f[i - 1][(k - y[i] + m) % m]) k = (k - y[i] + m) % m, p[i] = 1;
  }
  for (i = 1, c1 = c2 = 0; i <= n; i++) {
    if (p[i])
      c1 = i;
    else
      c2 = i;
  }
  for (i = 1; i <= n; i++) {
    if (!x[i]) continue;
    if (p[i]) {
      if (i != c1)
        x[c1] += x[i], a1[++cnt] = (x[i] + m - 1) / m, x[i] = 0, a2[cnt] = i,
                       a3[cnt] = c1;
    } else {
      if (i != c2)
        x[c2] += x[i], a1[++cnt] = (x[i] + m - 1) / m, x[i] = 0, a2[cnt] = i,
                       a3[cnt] = c2;
    }
  }
  if (x[c1] > q) {
    if (!c2) c2 = 1;
    a1[++cnt] = (x[c1] - q) / m, a2[cnt] = c1, a3[cnt] = c2;
  } else if (x[c1] < q) {
    if (x[c1] + (x[c2] / m * m) < q || !c2) {
      printf("NO");
      return 0;
    }
    if (!c1) c1 = 1;
    a1[++cnt] = (q - x[c1]) / m;
    a2[cnt] = c2;
    a3[cnt] = c1;
  }
  printf("YES\n");
  for (i = 1; i <= cnt; i++) printf("%d %d %d\n", a1[i], a2[i], a3[i]);
  return 0;
}
