#include <bits/stdc++.h>
using namespace std;
int n, k, V;
int a[200200];
int dp[5050][5050], marked[200200];
int path[5050][5050];
vector<int> tank;
struct mov {
  int from, to, cnt;
};
vector<mov> ans;
int knap(int pos, int vol) {
  if (pos == n + 1) return (vol == (V % k));
  int &ret = dp[pos][vol];
  if (ret != -1) return ret;
  ret = 0;
  int anst = 0, ansl = 0;
  anst = knap(pos + 1, (vol % k + (a[pos] % k)) % k);
  ansl = knap(pos + 1, vol);
  if (anst) path[pos][vol] = 1;
  if (ansl) path[pos][vol] = 0;
  return ret = (anst | ansl);
}
void go(int pos, int vol) {
  if (pos == n + 1) return;
  if (path[pos][vol] == 1) {
    tank.push_back(pos);
    go(pos + 1, (vol % k + (a[pos] % k)) % k);
    return;
  }
  if (path[pos][vol] == 0) {
    go(pos + 1, vol);
    return;
  }
}
int main() {
  memset(dp, -1, sizeof dp);
  memset(path, -1, sizeof path);
  scanf("%d %d %d", &n, &k, &V);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  int ret = knap(1, 0);
  if (ret != 1) {
    printf("NO\n");
    return 0;
  }
  if (V % k == 0) {
    for (int i = 2; i <= n; ++i) {
      a[1] += a[i];
      mov v;
      v.cnt = (a[i] / k) + (a[i] % k != 0);
      v.from = i;
      v.to = 1;
      if (v.cnt > 0) ans.push_back(v);
    }
    if (a[1] < V) {
      printf("NO\n");
      return 0;
    }
    mov v;
    v.cnt = V / k;
    v.from = 1;
    v.to = 2;
    if (v.cnt != 0) ans.push_back(v);
    printf("YES\n");
    for (auto mv : ans) printf("%d %d %d\n", mv.cnt, mv.from, mv.to);
    return 0;
  }
  go(1, 0);
  int sink = tank[0], all = a[sink];
  marked[sink] = 1;
  for (int i = 1; i < tank.size(); ++i) {
    mov v;
    v.cnt = a[tank[i]] / k + (a[tank[i]] % k != 0);
    v.from = tank[i];
    v.to = sink;
    if (v.cnt > 0) ans.push_back(v);
    all += a[tank[i]];
    marked[tank[i]] = 1;
  }
  if (all > V) {
    int sink2 = sink + 1;
    if (sink2 > n) sink2 -= n;
    mov v;
    v.cnt = (all - V) / k;
    v.from = sink;
    v.to = sink2;
    if (v.cnt > 0) ans.push_back(v);
  } else if (all < V) {
    int sink2 = -1;
    for (int i = 1; i <= n; ++i)
      if (!marked[i]) {
        sink2 = i;
        break;
      }
    if (sink2 == -1) {
      printf("NO\n");
      return 0;
    }
    for (int i = 1; i <= n; ++i) {
      if (marked[i] || (i == sink2) || a[i] == 0) continue;
      mov v;
      v.cnt = a[i] / k + (a[i] % k != 0);
      v.from = i;
      v.to = sink2;
      a[sink2] += a[i];
      if (v.cnt > 0) ans.push_back(v);
    }
    if (a[sink2] < (V - all)) {
      printf("NO\n");
      return 0;
    }
    mov v;
    v.cnt = (V - all) / k;
    v.from = sink2;
    v.to = sink;
    if (v.cnt > 0) ans.push_back(v);
  }
  printf("YES\n");
  for (auto mv : ans) printf("%d %d %d\n", mv.cnt, mv.from, mv.to);
}
