#include <bits/stdc++.h>
using namespace std;
int n, k, a[233], dep[233];
bitset<2005> s[12 + 1][1 << 16];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  s[0][0][0] = 1;
  for (int i = 1; i <= 12; ++i) {
    for (int g = 0; g < (1 << n); ++g)
      for (int w = 2000 / k; w >= 0; --w)
        if (s[i - 1][g][w * k]) s[i][g][w] = 1;
    for (int g = 0; g < (1 << n); ++g)
      for (int h = 0; h < n; ++h)
        if (!(g & (1 << h))) s[i][g | (1 << h)] |= s[i][g] << a[h];
  }
  if (!s[12][(1 << n) - 1][1]) {
    puts("NO");
    return 0;
  }
  puts("YES");
  int x = 12, y = (1 << n) - 1, z = 1;
  for (int g = x; g >= 1; --g) {
    if (g != x) z *= k;
    bool ok = 0;
    for (int p = 0; p <= y; ++p)
      if ((y & p) == p) {
        int su = 0;
        for (int t = 0; t < n; ++t)
          if (p & (1 << t)) su += a[t];
        if (su <= z && (z - su) * k <= 2000 && s[g - 1][y - p][(z - su) * k]) {
          ok = 1;
          for (int t = 0; t < n; ++t)
            if (p & (1 << t)) {
              dep[t] = 12 - g;
            }
          y -= p;
          z -= su;
          break;
        }
      }
    assert(ok);
  }
  priority_queue<pair<int, int> > pq;
  for (int t = 0; t < n; ++t) pq.push(pair<int, int>(dep[t], a[t]));
  while (pq.size() > 1) {
    pair<int, int> g = pq.top();
    pq.pop();
    pair<int, int> h = pq.top();
    pq.pop();
    assert(g.first == h.first);
    printf("%d %d\n", g.second, h.second);
    pair<int, int> z(g.first, g.second + h.second);
    while (z.second % k == 0) z.first--, z.second /= k;
    pq.push(z);
  }
  assert(pq.top().second == 1);
}
