#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
void read(int& x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
int n, m, a[3005], sum[3005];
char s[3005][3005];
void rev(int len) {
  for (int i = (1); i <= (len / 2); i++) swap(a[i], a[m - i + 1]);
}
pair<int, int> yf[3005];
int main() {
  read(n);
  read(m);
  int sum = 0;
  for (int i = (1); i <= (m); i++) read(a[i]), sum += a[i];
  sort(a + 1, a + m + 1);
  rev(m);
  int all = n * (n - 1) - sum;
  if (n != m) {
    int cnt = all / (n - m);
    for (int i = (m + 1); i <= (n); i++) a[i] = cnt;
    all -= (n - m) * cnt;
    for (int i = (m + 1); i <= (m + all); i++) a[i]++;
    all = 0;
  }
  if (all != 0) {
    printf("no\n");
    return 0;
  }
  for (int i = (1); i < (n); i++)
    if (a[i] < a[i + 1]) {
      printf("no\n");
      return 0;
    }
  for (int i = (1); i <= (n); i++) {
    all += a[n - i + 1];
    if (all < i * (i - 1)) {
      printf("no\n");
      return 0;
    }
  }
  for (int i = (1); i <= (n); i++) yf[i] = make_pair(a[i], i);
  for (int i = (n); i >= (1); i--) {
    sort(yf + 1, yf + i + 1);
    int now = 1;
    while (now < i && yf[i].first >= 2)
      yf[i].first -= 2, s[yf[i].second][yf[now].second] = 'W',
                        s[yf[now].second][yf[i].second] = 'L', now++;
    if (yf[i].first == 1) {
      s[yf[i].second][yf[now].second] = s[yf[now].second][yf[i].second] = 'D';
      yf[i].first--;
      yf[now].first--;
      now++;
    }
    while (now < i)
      s[yf[i].second][yf[now].second] = 'L',
      s[yf[now].second][yf[i].second] = 'W', yf[now].first -= 2, now++;
    s[yf[i].second][yf[i].second] = 'X';
  }
  printf("yes\n");
  for (int i = (1); i <= (n); i++) {
    for (int j = (1); j <= (n); j++) putchar(s[i][j]);
    putchar('\n');
  }
  return 0;
}
