#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "yes" : "no");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
int a[3005];
pair<int, int> c[3005];
char s[3005][3005];
bool cmp(int x, int y) { return x > y; }
bool pcmp(pair<int, int> a, pair<int, int> b) { return a.first > b.first; }
void fmain() {
  scanf("%d%d", &m, &n);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  sort(a + 1, a + 1 + n, cmp);
  int ss = m * (m - 1), S = 0;
  for (int i = 1, t = 0, tt = m + m - 2; i <= m; i++, tt -= 2) {
    if (i <= n) {
      S += a[i];
      t += tt;
      if (S > t) etp();
    } else {
      t += tt;
      int z = min(t - S, ss - S);
      z = min(a[i - 1], z);
      a[i] = z;
      S += z;
    }
  }
  if (S != ss) etp();
  for (int(i) = 1; (i) <= (int)(m); (i)++) {
    c[i].first = a[i];
    c[i].second = i;
  }
  for (int i = 1; i < m; i++) {
    sort(c + i, c + 1 + m, pcmp);
    int pt = c[i].first;
    int j = m;
    while (pt > 0) {
      if (pt > 1) {
        pt -= 2;
        s[c[i].second][c[j].second] = 'W';
        s[c[j].second][c[i].second] = 'L';
      } else {
        assert(pt == 1);
        pt--;
        c[j].first--;
        s[c[i].second][c[j].second] = 'D';
        s[c[j].second][c[i].second] = 'D';
      }
      j--;
    }
    for (int k = i + 1; k <= j; k++) {
      s[c[i].second][c[k].second] = 'L';
      s[c[k].second][c[i].second] = 'W';
      c[k].first -= 2;
    }
  }
  for (int(i) = 1; (i) <= (int)(m); (i)++) s[i][i] = 'X';
  puts("yes");
  for (int(i) = 1; (i) <= (int)(m); (i)++) {
    puts(s[i] + 1);
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain();
  }
  return 0;
}
