#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k, v;
  cin >> n >> k >> v;
  int arr[n];
  long long sum = 0;
  for (int i = 0; i != n; ++i) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (sum < v) {
    cout << "NO\n";
    return 0;
  }
  vector<int> all[k];
  for (int i = 0; i != n; ++i) {
    set<int> kehe;
    for (int j = 1; j != k; ++j) {
      if (all[j].empty() || kehe.count(j)) continue;
      int next = (arr[i] + j) % k;
      if (all[next].size() > 0) continue;
      kehe.insert(next);
      vector<int> zxc;
      for (int y : all[j]) zxc.push_back(y);
      zxc.push_back(i);
      all[next] = zxc;
    }
    int next = arr[i] % k;
    if (!all[next].empty()) continue;
    all[next] = vector<int>{i};
  }
  if (!all[v % k].empty() || (v % k) == 0) {
    int i = v % k;
    cout << "YES\n";
    long long cursum = 0;
    set<int> tmppp;
    for (int x : all[i]) {
      cursum += arr[x];
      tmppp.insert(x);
    }
    vector<int> leff;
    for (int j = 0; j != n; ++j)
      if (tmppp.count(j) == 0) leff.push_back(j);
    for (int j = 1; j < (int)all[i].size(); ++j) {
      int z = (arr[all[i][j]] + k - 1) / k;
      if (z > 0)
        cout << z << " " << all[i][j] + 1 << " " << all[i][0] + 1 << "\n";
    }
    for (int j = 1; j < (int)leff.size(); ++j) {
      int z = (arr[leff[j]] + k - 1) / k;
      if (z > 0) cout << z << " " << leff[j] + 1 << " " << leff[0] + 1 << "\n";
    }
    if (cursum < v) {
      int target = all[i].empty() ? leff[1] + 1 : all[i][0] + 1;
      cout << (v - cursum) / k << " " << leff[0] + 1 << " " << target << "\n";
    } else if (cursum > v) {
      int target = leff.empty() ? all[i][1] + 1 : leff[0] + 1;
      cout << (cursum - v) / k << " " << all[i][0] + 1 << " " << target << "\n";
    }
    return 0;
  }
  cout << "NO\n";
  return 0;
}
