#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 16, V = 2003;
using VMask = bitset<V>;
int a[N], b[N];
VMask dp[1 << N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  int lastmul = V - V % k;
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int x = lastmul; x >= 1; x -= k) {
      if (dp[mask][x]) {
        dp[mask][x / k] = 1;
      }
    }
    for (int i = 0; i < n; i++) {
      if (!(mask & (1 << i))) {
        dp[mask | (1 << i)] |= (dp[mask] << a[i]);
      }
    }
  }
  if (!dp[(1 << n) - 1][1]) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (int mask = (1 << n) - 1, x = 1, op = 0; mask != 0;) {
    bool found = false;
    for (int i = 0; i < n; i++) {
      if (!(mask & (1 << i))) continue;
      if (x < a[i]) continue;
      if (!dp[mask ^ (1 << i)][x - a[i]]) continue;
      found = true;
      b[i] = op;
      mask ^= (1 << i);
      x -= a[i];
      break;
    }
    if (!found) {
      x = k * x;
      op++;
    }
  }
  priority_queue<pair<int, int>> heap;
  for (int i = 0; i < n; i++) {
    heap.emplace(b[i], a[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    auto ex = heap.top();
    heap.pop();
    auto ey = heap.top();
    heap.pop();
    assert(ex.first == ey.first);
    cout << ex.second << ' ' << ey.second << '\n';
    int op = ex.first;
    int s = ex.second + ey.second;
    while (s % k == 0) {
      s /= k;
      op--;
    }
    heap.emplace(op, s);
  }
  return 0;
}
