#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
char ans[N][N];
int n, m, S;
pair<int, int> a[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n); i++) a[i].second = i;
  for (int i = (int)(n - m + 1); i <= (int)(n); i++) scanf("%d", &a[i].first);
  for (int i = (int)(n - m + 1); i <= (int)(n); i++) S += a[i].first;
  if (S > n * (n - 1)) return puts("no"), 0;
  S = n * (n - 1) - S;
  for (int i = (int)(1); i <= (int)(n - m); i++)
    a[i].first = S / (n - m) + (i <= S % (n - m));
  reverse(a + 1, a + n - m + 1);
  reverse(a + n - m + 1, a + n + 1);
  for (int i = (int)(1); i <= (int)(n - 1); i++)
    if (a[i].first > a[i + 1].first) return puts("no"), 0;
  S = 0;
  for (int i = (int)(1); i <= (int)(n); i++) {
    S += a[i].first;
    if (S < i * (i - 1)) return puts("no"), 0;
  }
  for (int i = (int)(1); i <= (int)(n); i++) ans[i][i] = 'X';
  for (int i = (int)(n); i >= (int)(1); i--) {
    sort(a + 1, a + i + 1);
    int rem = a[i].first;
    for (int j = (int)(1); j <= (int)(i - 1); j++)
      if (rem > 1) {
        ans[a[i].second][a[j].second] = 'W';
        ans[a[j].second][a[i].second] = 'L';
        rem -= 2;
      } else if (rem == 1) {
        ans[a[i].second][a[j].second] = 'D';
        ans[a[j].second][a[i].second] = 'D';
        rem -= 1;
        a[j].first -= 1;
      } else {
        ans[a[i].second][a[j].second] = 'L';
        ans[a[j].second][a[i].second] = 'W';
        a[j].first -= 2;
      }
  }
  puts("yes");
  for (int i = (int)(1); i <= (int)(n); i++) printf("%s\n", ans[i] + 1);
}
