#include <bits/stdc++.h>
const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};
const int N = 5005;
const int INF = (int)1e9 + 228;
using namespace std;
int a[N], dp[N][N][2];
bool used[N];
int main() {
  int n, k, V;
  scanf("%d%d%d", &n, &k, &V);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= k - 1; i++) dp[0][i][0] = dp[0][i][1] = -INF;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < k; j++) {
      dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
      int r = (j - (a[i] % k) + k) % k;
      dp[i][j][1] = max(dp[i - 1][r][0], dp[i - 1][r][1]) + a[i];
    }
  }
  int sum = 0;
  int ans = max(dp[n][V % k][0], dp[n][V % k][1]);
  int res = ans;
  int r = V % k;
  int to = -1;
  for (int i = n; i >= 1; i--) {
    if (dp[i][r][1] == ans) {
      r = (r - (a[i] % k) + k) % k;
      used[i] = true;
      to = i;
      ans -= a[i];
    } else
      sum += a[i];
  }
  if (res + (sum / k) * k < V) {
    cout << "NO" << endl;
    return 0;
  }
  printf("YES\n");
  int neto = 0;
  for (int i = 1; i <= n; i++) {
    if (i != to) neto = i;
  }
  for (int i = 1; i <= n; i++) {
    if (i == to || !a[i]) continue;
    if (used[i]) printf("%d %d %d\n", (a[i] + k - 1) / k, i, to);
  }
  for (int i = 1; i <= n; i++) {
    if (i == to || !a[i]) continue;
    if (!used[i] && i != neto)
      printf("%d %d %d\n", (a[i] + k - 1) / k, i, neto);
  }
  if (res < V) {
    if (to == -1) {
      for (int i = 1; i <= n; i++) {
        if (i != neto) to = i;
      }
    }
    printf("%d %d %d\n", (V - res) / k, neto, to);
  } else if (res > V) {
    printf("%d %d %d\n", (res - V) / k, to, neto);
  }
  return 0;
}
