#include <bits/stdc++.h>
using namespace std;
const int maxn = 16, MASK = 1 << 16, MAX = 2010;
int a[maxn], in[maxn];
bitset<MAX> bs[MASK];
multiset<pair<int, int> > st;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bs[0][0] = 1;
  for (int msk = 1; msk < (1 << n); msk++) {
    for (int i = 0; i < n; i++) {
      if ((((msk) >> (i)) & 1)) {
        bs[msk] = bs[msk] | (bs[msk ^ (1 << i)] << a[i]);
      }
    }
    for (int i = MAX - 1; i >= 0; i--) {
      if (i % k == 0 && bs[msk][i]) bs[msk][i / k] = 1;
    }
  }
  if (bs[(1 << n) - 1][1] == 0) return cout << "NO\n", 0;
  int msk = (1 << n) - 1, num = 1, dv = 0;
  while (msk > 0) {
    while (num < MAX) {
      for (int i = 0; i < n; i++) {
        if ((((msk) >> (i)) & 1)) {
          if (num >= a[i] && bs[msk ^ (1 << i)][num - a[i]]) {
            in[i] = dv;
            num -= a[i];
            msk ^= 1 << i;
            goto Hell;
          }
        }
      }
      num *= k, dv++;
    }
  Hell:;
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    st.insert({in[i], a[i]});
  }
  while (int((st).size()) > 1) {
    pair<int, int> A = *(--st.end());
    st.erase(st.find(A));
    pair<int, int> B = *(--st.end());
    st.erase(st.find(B));
    assert(A.first == B.first);
    cout << A.second << " " << B.second << "\n";
    int sum = A.second + B.second, pos = A.first;
    while (sum % k == 0) sum /= k, pos--;
    st.insert({pos, sum});
  }
  return 0;
}
