#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using pii = pair<INT, INT>;
using pi3 = pair<pii, INT>;
INT a[5010];
bool dp[5010][5010];
INT val[5010];
vector<pi3> ans;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  INT n, k, v;
  cin >> n >> k >> v;
  for (INT i = 1; i <= n; i++) cin >> a[i];
  INT sum = 0;
  for (INT i = 1; i <= n; i++) sum += a[i];
  if (sum < v) {
    cout << "NO" << endl;
    return 0;
  }
  for (INT i = 0; i < k; i++) val[i] = n + 1;
  dp[0][0] = 1;
  for (INT i = 1; i <= n; i++) {
    for (INT j = 0; j < k; j++)
      if (dp[i - 1][j]) {
        INT temp = (j + a[i]) % k;
        dp[i][temp] = 1;
        dp[i][j] = 1;
        val[temp] = min(val[temp], i);
      }
    dp[i][a[i] % k] = 1;
    val[a[i] % k] = min(val[a[i] % k], i);
  }
  INT p = v % k;
  int fff = 0;
  INT ID, sz;
  if (p == 0) {
    cout << "YES" << endl;
    if (a[1]) cout << (a[1] + k - 1) / k << " 1 2" << endl;
    a[2] += a[1];
    fff = 1;
    ID = 1;
    sz = 0;
  }
  if (!fff) {
    INT id = val[p];
    if (id == n + 1) {
      cout << "NO" << endl;
      return 0;
    }
    cout << "YES" << endl;
    ID = id;
    p -= (a[id] % k);
    if (p < 0) p += k;
    sz = a[id];
    id = val[p];
    while (p != 0) {
      p -= (a[id] % k);
      ans.push_back(pi3(pii(a[id] / k + 1, id), ID));
      sz += a[id];
      a[id] = 0;
      if (p < 0) p += k;
      id = val[p];
    }
  }
  INT sr = 1;
  if (ID == sr) sr = n;
  for (INT i = 1; i <= n; i++) {
    if (a[i] == 0 || i == ID || i == sr) continue;
    ans.push_back(pi3(pii((a[i] + k - 1) / k, i), sr));
  }
  INT val = (v - sz) / k;
  if (val > 0) {
    ans.push_back(pi3(pii(val, sr), ID));
  }
  if (val < 0) {
    ans.push_back(pi3(pii(-val, ID), sr));
  }
  for (auto p : ans) {
    INT u = p.first.first;
    INT sr = p.first.second;
    INT ta = p.second;
    cout << u << " " << sr << " " << ta << endl;
  }
  return 0;
}
