#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000;
int a[maxn + 5], b[maxn + 5];
bool dp[2][maxn + 5];
int pre[maxn + 5][maxn + 5];
int n, k, m;
bool use[maxn + 5];
vector<int> x, y;
int main() {
  scanf("%d%d%d", &n, &k, &m);
  long long s = 0;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    a[i] = x % k, b[i] = x / k;
    s += x;
  }
  if (s < m) return 0 * printf("NO\n");
  dp[0][0] = 1;
  int id = 0;
  for (int i = 1; i <= n; ++i) {
    id ^= 1;
    for (int j = 0; j < k; ++j)
      dp[id][j] = dp[id ^ 1][j], pre[i][j] = pre[i - 1][j];
    for (int j = 0; j < k; ++j)
      if (dp[id ^ 1][j])
        dp[id][(j + a[i]) % k] |= dp[id ^ 1][j], pre[i][(j + a[i]) % k] = i;
  }
  if (!dp[id][m % k]) return 0 * printf("NO\n");
  printf("YES\n");
  pair<int, int> now;
  now.first = pre[n][m % k];
  now.second = m % k;
  int ans = 0;
  while (now.first) {
    use[now.first] = 1;
    ans = now.first;
    int nx = pre[now.first - 1][(now.second - a[now.first] + k) % k];
    now.second = (now.second - a[now.first] + k) % k;
    now.first = nx;
  }
  s = b[ans] * k + a[ans];
  int other = 0;
  for (int i = 1; i <= n; ++i)
    if (!use[i]) {
      other = i;
      break;
    }
  for (int i = 1; i <= n; ++i)
    if (i != ans && i != other)
      if (use[i])
        printf("%d %d %d\n", b[i] + 1, i, ans), s += b[i] * k + a[i];
      else
        printf("%d %d %d\n", b[i] + 1, i, other);
  if (other == 0)
    if (ans == 1)
      other = 2;
    else
      other = 1;
  if (ans == 0)
    if (other == 1)
      ans = 2;
    else
      ans = 1;
  if (s < m) printf("%lld %d %d\n", (m - s) / k, other, ans);
  if (s > m) printf("%lld %d %d\n", (s - m) / k, ans, other);
  return 0;
}
