#include <bits/stdc++.h>
using namespace std;
namespace jumpmelon {
const int MAXN = 16, MAXS = 2000;
int n, k, A[MAXN], B[MAXN];
bitset<MAXS + 1> F[(1 << MAXN) + 3];
void getB(int S, int x) {
  if (S == 0)
    return;
  else if (x * k <= MAXS && F[S].test(x * k)) {
    getB(S, x * k);
    for (int i = 0; i < n; i++)
      if (S >> i & 1) B[i]++;
  } else {
    for (int i = 0; i < n; i++)
      if (A[i] <= x && (S >> i & 1) && F[S ^ (1 << i)].test(x - A[i]))
        return getB(S ^ (1 << i), x - A[i]);
  }
}
void work() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]);
  F[0].set(0);
  for (int S = 1; S < (1 << n); S++) {
    for (int i = 0; i < n; i++)
      if (S >> i & 1) F[S] |= F[S ^ (1 << i)] << A[i];
    for (int x = MAXS / k; x; x--)
      if (F[S].test(x * k)) F[S].set(x);
  }
  if (F[(1 << n) - 1].test(1)) {
    puts("YES");
    getB((1 << n) - 1, 1);
    priority_queue<pair<int, int> > Q;
    for (int i = 0; i < n; i++) Q.push(pair<int, int>(B[i], A[i]));
    while (Q.size() > 1) {
      pair<int, int> x = Q.top();
      Q.pop();
      pair<int, int> y = Q.top();
      Q.pop();
      printf("%d %d\n", x.second, y.second);
      int t = x.first, v = x.second + y.second;
      while (!(v % k)) {
        t--;
        v /= k;
      }
      Q.push(pair<int, int>(t, v));
    }
  } else
    puts("NO");
}
}  // namespace jumpmelon
int main() {
  jumpmelon::work();
  return 0;
}
