#include <bits/stdc++.h>
using namespace std;
const int maxN = 5e3 + 13;
int n, k, v, a[maxN], sum;
bool mark[maxN][maxN], dp[maxN][maxN], used[maxN];
vector<int> vec;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k >> v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < k; j++) {
      if (i == 0) {
        dp[i][a[i] % k] = true;
        mark[i][a[i] % k] = true;
        dp[i][0] = true;
      } else {
        if (dp[i - 1][(((j - a[i]) % k) + k) % k]) {
          dp[i][j] = mark[i][j] = true;
        } else
          dp[i][j] = dp[i - 1][j];
      }
    }
  if (dp[n - 1][v % k] == 0 || sum < v)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    int tank = n - 1, val = v % k;
    while (tank >= 0) {
      if (mark[tank][val]) {
        vec.push_back(tank);
        used[tank] = 1;
        val = (((val - a[tank]) % k) + k) % k;
      }
      tank--;
    }
    for (int i = 1; i < vec.size(); i++) {
      if ((int)ceil(double(a[vec[i]]) / k))
        cout << ceil(double(a[vec[i]]) / k) << " " << vec[i] + 1 << " "
             << vec[0] + 1 << '\n';
      a[vec[0]] += a[vec[i]];
    }
    int st = 0;
    for (int i = 0; i < n; i++) {
      if (!used[i]) {
        st = i;
        break;
      }
    }
    if (vec.size() == 0) {
      for (int i = 1; i < n; i++) {
        if ((int)ceil(double(a[i]) / k))
          cout << ceil(double(a[i]) / k) << " " << i + 1 << " " << 1 << endl;
        a[0] += a[i];
      }
      if (v / k) cout << v / k << " " << 1 << " " << 2 << endl;
    } else {
      if (a[vec[0]] > v) {
        cout << (a[vec[0]] - v) / k << " " << vec[0] + 1 << " " << st + 1
             << endl;
      } else if (a[vec[0]] < v) {
        for (int i = st + 1; i < n; i++) {
          if (!used[i]) {
            if ((int)ceil(double(a[i]) / k))
              cout << ceil(double(a[i]) / k) << " " << i + 1 << " " << st + 1
                   << '\n';
          }
        }
        cout << (v - a[vec[0]]) / k << " " << st + 1 << " " << vec[0] + 1
             << '\n';
      }
    }
  }
}
