#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
struct xxx {
  int k, i;
} a[N];
int sum, n, m, t, mn = 1e9;
int f[N][N];
bool com(xxx a, xxx b) { return a.k < b.k; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) a[i].i = i;
  for (int i = n - m + 1; i <= n; i++) {
    scanf("%d", &a[i].k);
    t += a[i].k;
    mn = min(mn, a[i].k);
  }
  if (t > (n - 1) * n) {
    printf("no");
    return 0;
  }
  t = n * (n - 1) - t;
  for (int i = 1; i <= n - m; i++) a[i].k = t / (n - m) + (i <= t % (n - m));
  if (n - m && a[1].k > mn) return puts("no"), 0;
  sort(a + 1, a + n + 1, com);
  int x = 0;
  for (int i = 1; i <= n; i++) {
    x += a[i].k;
    if (x < i * (i - 1)) {
      printf("no");
      return 0;
    }
  }
  printf("yes\n");
  for (int i = n; i >= 1; i--) {
    sort(a + 1, a + i + 1, com);
    int t = a[i].k;
    for (int j = 1; j < i; j++) {
      if (t >= 2) {
        t -= 2;
        f[a[i].i][a[j].i] = 2;
        f[a[j].i][a[i].i] = 0;
      } else if (t == 1) {
        t -= 1;
        a[j].k -= 1;
        f[a[i].i][a[j].i] = 1;
        f[a[j].i][a[i].i] = 1;
      } else {
        a[j].k -= 2;
        f[a[i].i][a[j].i] = 0;
        f[a[j].i][a[i].i] = 2;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      if (i == j)
        putchar('X');
      else if (f[i][j] == 0)
        putchar('L');
      else if (f[i][j] == 1)
        putchar('D');
      else
        putchar('W');
    puts("");
  }
  return 0;
}
