#include <bits/stdc++.h>
using namespace std;
int n, k, b;
int a[16], amt[16];
bitset<2001> dp[1 << 16];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  dp[0][0] = 1;
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 2000; i >= 1; i--) {
      if (dp[mask][i] && (i % k == 0)) {
        dp[mask][i / k] = 1;
      }
    }
    for (int i = 0; i < n; i++) {
      if (!((mask >> i) & 1)) {
        dp[mask | (1 << i)] |= dp[mask] << a[i];
      }
    }
  }
  if (dp[(1 << n) - 1][1]) {
    cout << "YES" << endl;
    int curr = 0;
    int mask = (1 << n) - 1;
    int v = 1;
    while (mask) {
      while (v * k <= 2000 && dp[mask][v * k]) {
        v *= k;
        curr++;
      }
      for (int i = 0; i < n; i++) {
        if (((mask >> i) & 1) && v >= a[i] && (dp[mask ^ (1 << i)][v - a[i]])) {
          mask ^= (1 << i);
          v -= a[i];
          amt[i] = curr;
          break;
        }
      }
    }
    priority_queue<pair<int, int>> pq;
    for (int i = 0; i < n; i++) {
      pq.push(make_pair(amt[i], a[i]));
    }
    while (pq.size() > 1) {
      pair<int, int> a = pq.top();
      pq.pop();
      pair<int, int> b = pq.top();
      pq.pop();
      cout << a.second << " " << b.second << "\n";
      pair<int, int> c = make_pair(a.first, a.second + b.second);
      while (c.second % k == 0) {
        c.second /= k;
        c.first -= 1;
      }
      pq.push(c);
    }
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
