#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  T x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int N = 17, M = 2010;
int n, k, a[N], lim, sum;
bitset<M> f[1 << N];
void dp() {
  f[0][0] = 1;
  for (int i = 1; i < lim; i++) {
    for (int j = 1; j <= n; j++) {
      if ((i >> (j - 1) & 1)) {
        f[i] |= (f[i ^ (1 << (j - 1))] << a[j]);
      }
    }
    for (int j = sum / k; j >= 1; j--) f[i][j] = f[i][j] | f[i][j * k];
  }
}
int b[N];
priority_queue<pair<int, int> > q;
void getsolution() {
  int curi = lim - 1, curj = 1;
  while (curi || curj) {
    if (curj && curj * k <= sum && f[curi][curj * k]) {
      curj *= k;
      for (int i = 1; i <= n; i++) {
        if (curi >> (i - 1) & 1) b[i]++;
      }
    }
    for (int i = 1; i <= n; i++) {
      if ((curi >> (i - 1) & 1) && curj >= a[i] &&
          f[curi ^ (1 << (i - 1))][curj - a[i]]) {
        curi ^= (1 << (i - 1)), curj -= a[i];
        break;
      }
    }
  }
  for (int i = 1; i <= n; i++) q.push(make_pair(b[i], a[i]));
  while (q.size() > 1) {
    auto tmp1 = q.top();
    q.pop();
    auto tmp2 = q.top();
    q.pop();
    printf("%d %d\n", tmp1.second, tmp2.second);
    int sum = tmp1.second + tmp2.second;
    while (sum % k == 0) sum /= k, tmp1.first--;
    q.push(make_pair(tmp1.first, sum));
  }
}
int main() {
  n = read<int>(), k = read<int>();
  lim = 1 << n;
  for (int i = 1; i <= n; i++) a[i] = read<int>(), sum += a[i];
  dp();
  if (!f[lim - 1][1]) {
    puts("NO");
    return 0;
  }
  puts("YES");
  getsolution();
  return 0;
}
