#include <bits/stdc++.h>
using namespace std;
int a[16], dep[16], n, k;
bitset<2048> dp[65536];
bool dfs(int s, int x, int d) {
  if (x >= 2048) return false;
  if (!s) return !x;
  for (int i = 0; i != n; ++i)
    if ((s >> i & 1) && x >= a[i] && dp[s ^ 1 << i][x - a[i]])
      return dfs(s ^ 1 << i, x - a[i], dep[i] = d);
  return dfs(s, x * k, d + 1);
}
int main() {
  cin >> n >> k;
  for (int i = 0; i != n; ++i) cin >> a[i];
  dp[0][0] = 1;
  for (int s = 1; s != (1 << n); ++s) {
    for (int i = 0; i != n; ++i)
      if (s >> i & 1) dp[s] |= dp[s ^ 1 << i] << a[i];
    for (int i = 2047 / k; i; --i) dp[s][i] = dp[s][i] | dp[s][i * k];
  }
  if (!dp[(1 << n) - 1][1]) return cout << "NO" << endl, 0;
  cout << "YES" << endl;
  assert(dfs((1 << n) - 1, 1, 0));
  priority_queue<pair<int, int>> heap;
  for (int i = 0; i != n; ++i) heap.emplace(dep[i], a[i]);
  while (true) {
    pair<int, int> top = heap.top();
    heap.pop();
    if (heap.empty()) break;
    assert(top.first == heap.top().first);
    cout << top.second << " " << heap.top().second << endl;
    for (top.second += heap.top().second; top.second % k == 0; top.second /= k)
      --top.first;
    heap.pop();
    heap.push(top);
  }
}
