#include <bits/stdc++.h>
using namespace std;
const int MAXSIZE = 30000020;
int bufpos;
char buf[MAXSIZE];
void init() {
  buf[fread(buf, 1, MAXSIZE, stdin)] = '\0';
  bufpos = 0;
}
int readint() {
  int val = 0;
  for (; !isdigit(buf[bufpos]); bufpos++)
    ;
  for (; isdigit(buf[bufpos]); bufpos++) val = val * 10 + buf[bufpos] - '0';
  return val;
}
char readchar() {
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  return buf[bufpos++];
}
int readstr(char* s) {
  int cur = 0;
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  for (; !isspace(buf[bufpos]); bufpos++) s[cur++] = buf[bufpos];
  s[cur] = '\0';
  return cur;
}
pair<int, int> a[5002];
char d[5002][5002];
void fail() {
  puts("no");
  exit(0);
}
int main() {
  init();
  int m = readint(), n = readint(), t = 0, mn = 2 * m + 1;
  for (int i = 1; i <= m; i++) {
    a[i].second = i;
    if (i > m - n) {
      t += (a[i].first = readint());
      mn = min(mn, a[i].first);
    }
  }
  if (t > m * (m - 1)) fail();
  t = m * (m - 1) - t;
  for (int i = 1; i <= m - n; i++)
    a[i].first = t / (m - n) + (i <= t % (m - n));
  if (m - n && a[1].first > mn) fail();
  sort(a + 1, a + m + 1);
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    sum += a[i].first;
    if (sum < i * (i - 1)) fail();
  }
  for (int i = m; i; i--) {
    sort(a + 1, a + i + 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 = 0;
        d[a[i].second][a[j].second] = d[a[j].second][a[i].second] = 'D';
        a[j].first--;
      } else {
        d[a[i].second][a[j].second] = 'L';
        d[a[j].second][a[i].second] = 'W';
        a[j].first -= 2;
      }
    }
  }
  for (int i = 1; i <= m; i++) d[i][i] = 'X';
  puts("yes");
  for (int i = 1; i <= m; i++) puts(d[i] + 1);
}
