#include <bits/stdc++.h>
using namespace std;
const double eps = 0.00001;
const int MOD = 998244353;
const int INF = 1e9 + 5;
const long long LLINF = 1223372000000000555;
const int N = 2355555;
const int M = 6024;
int a[N], b[N];
bool dp[M][M];
bool used[N];
void solve() {
  int n, k, V;
  cin >> n >> k >> V;
  int vv = V % k;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = a[i] % k;
    sum += a[i];
  }
  if (sum < V) {
    cout << "NO";
    return;
  }
  if (vv == 0) {
    cout << "YES\n";
    for (int i = 1; i < n; i++) {
      if (a[i] == 0) continue;
      cout << (a[i] + k - 1) / k << ' ' << i << ' ' << n << endl;
      a[n] += a[i];
      a[i] = 0;
    }
    if (V > 0) cout << V / k << ' ' << n << ' ' << 1;
    return;
  }
  for (int i = 0; i <= n; i++) {
    dp[0][i] = true;
  }
  for (int i = 1; i <= n; i++) {
    for (int x = 0; x < k; x++) {
      dp[x][i] = dp[x][i - 1];
      int y = ((x - b[i]) % k + k) % k;
      dp[x][i] |= dp[y][i - 1];
    }
  }
  if (!dp[vv][n]) {
    cout << "NO";
    return;
  }
  cout << "YES\n";
  vector<int> v;
  for (int i = n; i >= 1; i--) {
    int y = ((vv - b[i]) % k + k) % k;
    if (dp[y][i - 1]) {
      v.push_back(i);
      vv = y;
      used[i] = true;
    }
  }
  int idx = v[0], idx2 = -1;
  for (int i = 1; i <= n; i++) {
    if (!used[i]) idx2 = i;
  }
  for (int i = 1; i < v.size(); i++) {
    int j = v[i];
    if (a[j] == 0) continue;
    int cnt = (a[j] + k - 1) / k;
    a[idx] += a[j];
    a[j] = 0;
    cout << cnt << ' ' << j << ' ' << idx << endl;
  }
  if (idx2 != -1) {
    for (int i = 1; i <= n; i++) {
      if (i == idx2 || i == idx || used[i] || a[i] == 0) continue;
      cout << (a[i] + k - 1) / k << ' ' << i << ' ' << idx2 << endl;
      a[idx2] += a[i];
      a[i] = 0;
    }
  }
  if (a[idx] < V) {
    for (int i = 1; i <= n; i++) {
      if (a[idx] >= V) break;
      if (i == idx || a[i] < k) continue;
      a[idx] += a[i] / k * k;
      cout << a[i] / k << ' ' << i << ' ' << idx << endl;
    }
  }
  int x = (a[idx] - V) / k;
  if (x > 0) cout << x << ' ' << idx << ' ' << (idx == n ? n - 1 : 1) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
