#include <bits/stdc++.h>
using namespace std;
int n, m, all, a[17], s[65537], rev[65537], d[65537];
bitset<16002> f[65537];
bool vis[65537];
void dfs(int S) {
  if (vis[S]) return;
  vis[S] = 1;
  int i;
  for (i = 0; i < n; i++)
    if (S & (1 << i)) dfs(S ^ (1 << i)), f[S] |= f[S ^ (1 << i)] << a[i];
  for (i = (s[S] / m) * m; i > 0; i -= m) f[S][i] ? (f[S][d[i]] = 1) : 0;
}
int b[17];
void dfs1(int S, int x) {
  if (!x) return;
  if ((x * m <= s[S]) && f[S][x * m]) {
    for (int i = 0; i < n; i++) b[i] += (S >> i) & 1;
    return dfs1(S, x * m);
  }
  for (int i = 0; i < n; i++)
    if ((S & (1 << i)) && (x >= a[i]) && f[S ^ (1 << i)][x - a[i]])
      return dfs1(S ^ (1 << i), x - a[i]);
}
int main() {
  scanf("%d%d", &n, &m);
  all = 1 << n;
  int i, mx = 0, A, B;
  for (i = 0; i < n; i++) scanf("%d", &a[i]), rev[1 << i] = i;
  for (i = 1; i < all; i++) s[i] = s[i & (i - 1)] + a[rev[i & (-i)]];
  f[0][0] = 1;
  vis[0] = 1;
  for (i = 0; i < 65537; i += m) d[i] = i / m;
  dfs(all - 1);
  if (!f[all - 1][1]) {
    printf("NO");
    return 0;
  }
  printf("YES\n");
  dfs1(all - 1, 1);
  while (n > 1) {
    mx = 0;
    for (i = 0; i < n; i++) mx = max(mx, b[i]);
    A = B = -1;
    for (i = 0; i < n; i++)
      if (b[i] == mx) ((A == (-1)) ? A : B) = i;
    printf("%d %d\n", a[A], a[B]);
    a[A] += a[B];
    while (d[a[A]]) a[A] = d[a[A]], --b[A];
    a[B] = a[n - 1];
    b[B] = b[n - 1];
    --n;
  }
  return 0;
}
