#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
using namespace std;
const int maxn = 16, maxk = 2009, maxe = 200;
int n, k, a[maxn];
bitset<maxk> dp[1 << maxn];
vector<int> res[maxe];
int main() {
  cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  dp[0][0] = 1;
  for (int i = (0); i < (1 << n); ++i) {
    for (int j = int(maxk) - 1; j >= (0); --j)
      if (j % k == 0 && dp[i][j]) dp[i][j / k] = 1;
    for (int l = (0); l < (n); ++l) {
      if (!((i >> l) & 1)) {
        dp[i | (1 << l)] |= dp[i] << a[l];
      }
    }
  }
  if (!dp[(1 << n) - 1][1]) return cout << "NO\n", 0;
  cout << "YES\n";
  int e = 0;
  pair<int, int> t = {(1 << n) - 1, 1};
  while (t != pair<int, int>(0, 0)) {
    if (t.second * k < maxk && dp[t.first][t.second * k]) {
      t.second *= k, ++e;
    } else {
      for (int i = (0); i < (n); ++i) {
        if (((t.first >> i) & 1) && t.second >= a[i] &&
            dp[t.first & ~(1 << i)][t.second - a[i]]) {
          res[e].push_back(a[i]);
          t = {t.first & ~(1 << i), t.second - a[i]};
          break;
        }
      }
    }
  }
  int x = -1, y = -1;
  for (int i = int(e + 1) - 1; i >= (1); --i) {
    for (int j = (0); j < (res[i].size()); ++j) {
      int t = res[i][j];
      if (t % k == 0) {
        res[i - 1].push_back(t / k);
      } else {
        if (x < 0)
          x = t;
        else {
          y = t;
          cout << x << " " << y << '\n';
          res[i].push_back(x + y);
          x = y = -1;
        }
      }
    }
  }
}
