#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int a[N];
bool dp[N][N];
bool pre[N][N];
int main() {
  ios::sync_with_stdio(false);
  int n, k, v, vtmp, s = 0;
  cin >> n >> k >> v;
  vtmp = v;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    s += a[i];
  }
  if (s < v) {
    cout << "NO" << endl;
    return 0;
  }
  v %= k;
  dp[0][0] = true;
  for (int i = 1; i <= n; ++i) {
    int t = a[i] % k;
    for (int j = 0; j < k; ++j) {
      if (dp[i - 1][j] == false) continue;
      dp[i][j] = true;
      pre[i][j] = false;
      dp[i][(j + t) % k] = true;
      pre[i][(j + t) % k] = true;
    }
  }
  if (!dp[n][v]) return !printf("NO");
  vector<int> v0, v1;
  for (int i = n; i >= 1; --i) {
    if (pre[i][v]) {
      v1.push_back(i);
      int t = a[i] % k;
      v = (v - t + k) % k;
    } else {
      v0.push_back(i);
    }
  }
  sort(v0.begin(), v0.end());
  sort(v1.begin(), v1.end());
  s = 0;
  for (int i = 0; i < v1.size(); ++i) s += a[v1[i]];
  printf("YES\n");
  for (int i = 1; i < v0.size(); ++i) {
    printf("%d %d %d\n", a[v0[i]] / k + 1, v0[i], v0[0]);
  }
  for (int i = 1; i < v1.size(); ++i) {
    printf("%d %d %d\n", a[v1[i]] / k + 1, v1[i], v1[0]);
  }
  int t0, t1;
  if (v0.size() == 0) {
    t0 = v1[1];
    t1 = v1[0];
  } else if (v1.size() == 0) {
    t0 = v0[0];
    t1 = v0[1];
  } else {
    t0 = v0[0];
    t1 = v1[0];
  }
  if (s < vtmp) {
    printf("%d %d %d\n", (vtmp - s) / k, t0, t1);
  } else if (s > vtmp) {
    printf("%d %d %d\n", (s - vtmp) / k, t1, t0);
  }
  return 0;
}
