#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
pair<int, int> a[3005];
char d[3005][3005];
int main() {
  m = read();
  n = read();
  int t = 0, minv = 1e9;
  for (int i = m - n + 1; i <= m; i++) {
    a[i].first = read();
    a[i].second = i;
    t += a[i].first;
    minv = min(minv, a[i].first);
  }
  if (t > m * (m - 1)) {
    printf("no\n");
    return 0;
  }
  t = m * (m - 1) - t;
  for (int i = 1; i <= m - n; i++)
    a[i] = make_pair(t / (m - n) + (i <= t % (m - n)), i);
  if (m - n && a[1].first > minv) {
    printf("no\n");
    return 0;
  }
  sort(a + 1, a + m + 1);
  t = 0;
  for (int i = 1; i <= m; i++) {
    t += a[i].first;
    if (t < i * (i - 1)) {
      printf("no\n");
      return 0;
    }
  }
  for (int i = 1; i <= m; i++) d[i][i] = 'X';
  for (int i = m; i; i--) {
    sort(a + 1, a + m + 1);
    int t = a[i].first;
    for (int j = 1; j < i; j++) {
      if (t > 1) {
        t -= 2;
        d[a[i].second][a[j].second] = 'W';
        d[a[j].second][a[i].second] = 'L';
      } else if (t == 1) {
        t--;
        a[j].first--;
        d[a[i].second][a[j].second] = d[a[j].second][a[i].second] = 'D';
      } else {
        a[j].first -= 2;
        d[a[i].second][a[j].second] = 'L';
        d[a[j].second][a[i].second] = 'W';
      }
    }
  }
  printf("yes\n");
  for (int i = 1; i <= m; i++) printf("%s\n", d[i] + 1);
  return 0;
}
