#include <bits/stdc++.h>
struct {
  inline operator int() {
    int x;
    return scanf("%d", &x), x;
  }
  template <class T>
  inline void operator()(T &x) {
    x = *this;
  }
} read;
const int maxn = 16, maxk = 2048;
int a[maxn], b[maxn];
std::bitset<maxk> f[1 << maxn], g[1 << maxn];
int main() {
  int n = read, k = read;
  for (int i = 0; i < n; i++) read(a[i]);
  f[0][0] = 1;
  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)] << size_t(a[i]);
    for (int x = (maxk - 1) / k; x >= 0; x--)
      if (f[S][size_t(x * k)] and !f[S][size_t(x)])
        f[S][size_t(x)] = g[S][size_t(x)] = 1;
  }
  int S = (1 << n) - 1, x = 1;
  if (!f[S][size_t(x)]) return puts("NO"), 0;
  puts("YES");
  while (S) {
    while (g[S][size_t(x)]) {
      x *= k;
      for (int i = 0; i < n; i++)
        if (S >> i & 1) ++b[i];
    }
    for (int i = 0; i < n; i++)
      if (x >= a[i] and S >> i & 1 and f[S ^ (1 << i)][size_t(x - a[i])]) {
        S ^= 1 << i;
        x -= a[i];
        break;
      }
  }
  std::priority_queue<std::pair<int, int> > q;
  for (int i = 0; i < n; i++) q.push(std::pair<int, int>(b[i], a[i]));
  while (q.size() > 1) {
    std::pair<int, int> p1 = q.top();
    q.pop();
    std::pair<int, int> p2 = q.top();
    q.pop();
    if (p1.first != p2.first) return 1;
    printf("%d %d\n", p1.second, p2.second);
    p1.second += p2.second;
    while (p1.second % k == 0) --p1.first, p1.second /= k;
    q.push(p1);
  }
}
