#include <bits/stdc++.h>
using namespace std;
const int maxn = 16;
const int maxk = 2005;
int a[maxn];
bitset<maxk> dp[1 << maxn];
int n, k;
vector<pair<int, int>> output;
void solve(int mask, int goal) {
  if (mask == 0) {
    return;
  }
  if (goal * k < maxk && dp[mask][goal * k]) {
    solve(mask, goal * k);
    for (int i = 0; i < output.size(); i++) {
      output[i].first += 1;
    }
    return;
  }
  for (int j = 0; j < n; j++) {
    if ((mask >> j) & 1) {
      if (goal >= a[j] && dp[mask ^ (1 << j)][goal - a[j]]) {
        solve(mask ^ (1 << j), goal - a[j]);
        output.push_back(make_pair(0, a[j]));
        return;
      }
    }
  }
}
void work() {
  while (scanf("%d %d", &n, &k) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    dp[0] = 1;
    for (int i = 1; i < (1 << n); i++) {
      dp[i] = 0;
      for (int j = 0; j < n; j++) {
        if ((i >> j) & 1) {
          dp[i] |= (dp[i ^ (1 << j)] << a[j]);
        }
      }
      for (int j = maxk / k; j >= 1; j--) {
        if (dp[i][j * k]) {
          dp[i][j] = 1;
        }
      }
    }
    if (dp[(1 << n) - 1][1]) {
      printf("YES\n");
    } else {
      printf("NO\n");
      continue;
    }
    output.clear();
    solve((1 << n) - 1, 1);
    while (output.size() > 1) {
      sort(output.begin(), output.end());
      int len = output.size();
      if (!(output[len - 1].first == output[len - 2].first)) throw "re";
      ;
      int x = output[len - 1].second;
      int y = output[len - 2].second;
      printf("%d %d\n", x, y);
      output.resize(len - 2);
      int p = x + y;
      int cnt = output[len - 1].first;
      while (p % k == 0) {
        p = p / k;
        cnt -= 1;
      }
      output.push_back(make_pair(cnt, p));
    }
  }
}
int main() {
  work();
  return 0;
}
