#include <bits/stdc++.h>
using namespace std;
int n, m, a[3001], pos[3001], c[3001][3001];
bool cmp(const int &x, const int &y) { return a[x] > a[y]; }
int main() {
  scanf("%d%d", &n, &m);
  int tot = n * (n - 1);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]), tot -= a[i];
  if (n == m && tot) {
    printf("no\n");
    return 0;
  }
  for (int i = m + 1; i <= n; i++) a[i] = tot / (n - m);
  if (n != m)
    for (int i = m + 1, j = 1; j <= tot % (n - m); j++, i++) ++a[i];
  if (n != m && a[m + 1] > a[m]) {
    printf("no\n");
    return 0;
  }
  int sum1 = 0, sum2 = 0;
  for (int i = 1; i <= n; i++) {
    sum1 += (n - i) * 2;
    sum2 += a[i];
    if (sum2 > sum1) {
      printf("no\n");
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) pos[i] = i;
  for (int i = 1; i <= n; i++) {
    sort(pos + i, pos + n + 1, cmp);
    int dist = (n - i) * 2 - a[pos[i]];
    for (int j = i + 1, k = 1; j <= n, k <= dist / 2; j++, k++)
      a[pos[j]] -= 2, c[pos[i]][pos[j]] = 0, c[pos[j]][pos[i]] = 2;
    if (dist & 1)
      c[pos[i]][pos[i + dist / 2 + 1]] = c[pos[i + dist / 2 + 1]][pos[i]] = 1,
                                   --a[pos[i + dist / 2 + 1]];
    for (int j = i + dist / 2 + 1 + (dist & 1); j <= n; j++)
      c[pos[i]][pos[j]] = 2, c[pos[j]][pos[i]] = 0;
  }
  printf("yes\n");
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      if (i == j)
        printf("X");
      else if (!c[i][j])
        printf("L");
      else if (c[i][j] == 1)
        printf("D");
      else
        printf("W");
    printf("\n");
  }
}
