#include <bits/stdc++.h>
using namespace std;
int n, k, v;
const int N = 5010;
int a[N];
int m[N][N];
int count(int x, int y) {
  int cnt = a[x] / k;
  if (a[x] % k != 0) {
    cnt++;
  }
  a[y] += a[x];
  a[x] = 0;
  return cnt;
}
struct Node {
  int cnt, x, y;
} ans[N];
int main() {
  scanf("%d %d %d", &n, &k, &v);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  m[0][0] = true;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < k; ++j) {
      if (m[i][j]) {
        m[i + 1][j] = true;
        m[i + 1][(j + (a[i + 1]) % k) % k] = true;
      }
    }
  }
  if (!m[n][v % k]) {
    printf("NO\n");
    return 0;
  }
  vector<int> sequence;
  int res = v % k;
  for (int i = n; i > 0; --i) {
    if (m[i - 1][res]) {
      continue;
    }
    sequence.push_back(i);
    res -= a[i] % k;
    if (res < 0) {
      res += k;
    }
  }
  int tank1, tank2 = -1;
  int cur = 0;
  if (sequence.empty()) {
    ans[++cur] = (Node){count(1, 2), 1, 2};
    tank1 = 1;
  } else {
    tank1 = sequence[0];
  }
  for (int i = 1; i < sequence.size(); ++i) {
    ans[++cur] = (Node){count(sequence[i], tank1), sequence[i], tank1};
  }
  for (int i = 1; i <= n; ++i) {
    if (i != tank1) {
      tank2 = i;
      break;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if ((i != tank1) && (i != tank2) && a[i]) {
      ans[++cur] = (Node){count(i, tank2), i, tank2};
    }
  }
  if (a[tank1] < v) {
    int gap = (v - a[tank1]) / k;
    int cnt = min(a[tank2] / k, gap);
    if (cnt < gap) {
      printf("NO\n");
      return 0;
    }
    ans[++cur] = (Node){cnt, tank2, tank1};
    a[tank1] += cnt * k;
    a[tank2] -= cnt * k;
  } else if (a[tank1] > v) {
    int gap = (a[tank1] - v) / k;
    ans[++cur] = (Node){gap, tank1, tank2};
  }
  printf("YES\n");
  for (int i = 1; i <= n; ++i) {
    if (ans[i].cnt) {
      printf("%d %d %d\n", ans[i].cnt, ans[i].x, ans[i].y);
    }
  }
  return 0;
}
