#include <bits/stdc++.h>
using namespace std;
void getre() {
  int x = 0;
  printf("%d\n", 1 / x);
}
void gettle() {
  int res = 1;
  while (1) res <<= 1;
  printf("%d\n", res);
}
template <typename T, typename S>
inline bool upmin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool upmax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename N, typename PN>
inline N flo(N a, PN b) {
  return a >= 0 ? a / b : -((-a - 1) / b) - 1;
}
template <typename N, typename PN>
inline N cei(N a, PN b) {
  return a > 0 ? (a - 1) / b + 1 : -(-a / b);
}
template <typename N>
N gcd(N a, N b) {
  return b ? gcd(b, a % b) : a;
}
template <typename N>
inline int sgn(N a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
inline void gn(long long &x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gn(long double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gs(char *s) { scanf("%s", s); }
inline void gc(char &c) {
  while ((c = getchar()) > 126 || c < 33)
    ;
}
inline void pc(char c) { putchar(c); }
inline long long sqr(long long a) { return a * a; }
inline double sqrf(double a) { return a * a; }
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846264338327950288L;
const double eps = 1e-6;
int n, m;
int a[6333];
int id[6333];
int presum[6333];
int tot;
int ans[3333][3333];
vector<int> in[6444], out[6444];
int ok[6666];
int tmp[6666], tmpid[6666];
int main() {
  gn(n);
  gn(m);
  for (int i = (1), _ed = (m + 1); i < _ed; i++) gn(a[i]);
  sort(a + 1, a + 1 + m);
  reverse(a + 1, a + 1 + m);
  tot = n * (n - 1);
  for (int i = (1), _ed = (m + 1); i < _ed; i++) {
    presum[i] = a[i] + presum[i - 1];
  }
  if (presum[m] > tot || presum[m] + (n - m) * a[m] < tot) {
    printf("no\n");
    return 0;
  }
  if (m != n) {
    int lef = tot - presum[m];
    int q = lef / (n - m);
    for (int i = (m + 1), _ed = (n + 1); i < _ed; i++) a[i] = q;
    int r = lef % (n - m);
    for (int i = (m + 1), _ed = (m + r + 1); i < _ed; i++) a[i]++;
  }
  int su = 0;
  for (int i = 1; i <= n; i++) {
    su += a[n - i + 1];
    if (su < i * (i - 1)) {
      printf("no\n");
      return 0;
    }
  }
  printf("yes\n");
  for (int i = (1), _ed = (n + 1); i < _ed; i++) id[i] = i;
  for (int i = (1), _ed = (n); i < _ed; i++) {
    memset(ok, 0, sizeof(ok));
    int fen = a[i];
    int lef = n - i;
    for (int j = (0), _ed = (2 * (n - i + 1) + 1); j < _ed; j++) in[j].clear();
    for (int j = (i + 1), _ed = (n + 1); j < _ed; j++) {
      in[a[j]].push_back(j);
    }
    int curma = a[i + 1];
    fen = 2 * lef - fen;
    while (fen) {
      while (in[curma].empty()) curma--;
      int x = in[curma].back();
      in[curma].pop_back();
      if (ok[x] != 2) {
        ok[x]++;
        fen--;
        in[curma - 1].push_back(x);
      } else {
        out[curma].push_back(x);
      }
    }
    for (int j = (i + 1), _ed = (n + 1); j < _ed; j++) {
      ans[id[i]][id[j]] = ok[j];
      ans[id[j]][id[i]] = 2 - ok[j];
    }
    int tmptot = 0;
    for (int j = a[i + 1]; j >= 0; j--) {
      while (!in[j].empty()) {
        int x = in[j].back();
        in[j].pop_back();
        tmp[++tmptot] = x;
        a[tmptot + i] = j;
      }
      while (!out[j].empty()) {
        int x = out[j].back();
        out[j].pop_back();
        tmp[++tmptot] = x;
        a[tmptot + i] = j;
      }
    }
    for (int t = (1), _ed = (tmptot + 1); t < _ed; t++) {
      tmpid[t + i] = id[tmp[t]];
    }
    for (int t = (1), _ed = (tmptot + 1); t < _ed; t++) {
      id[t + i] = tmpid[t + i];
    }
  }
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    for (int j = (1), _ed = (n + 1); j < _ed; j++) {
      if (i == j)
        putchar('X');
      else if (ans[i][j] == 2)
        putchar('L');
      else if (ans[i][j] == 1)
        putchar('D');
      else
        putchar('W');
    }
    putchar('\n');
  }
  return 0;
}
