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