#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  std::vector<int> a(m);
  std::vector<std::pair<int, int> > fp;
  std::vector<std::vector<int> > ans(n, std::vector<int>(n));
  for (int i = 0; i < n; i++) ans[i][i] = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      ans[i][j] = 1;
      ans[j][i] = -1;
    }
  for (int i = m; i < n; i++)
    for (int j = m; j < n; j++) ans[i][j] = 0;
  int sum = 0;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    sum += a[i];
    if (sum > 2 * (i + 1) * (n - i - 1) + i * (i + 1)) {
      cout << "no";
      return 0;
    }
  }
  int pleft = n * (n - 1) - sum;
  if (m == n) {
    if (pleft != 0) {
      cout << "no";
      return 0;
    }
  } else {
    int pmax = (pleft + (n - m - 1)) / (n - m);
    if (pmax > a.back()) {
      cout << "no";
      return 0;
    }
  }
  for (int i = 0; i < m; i++) {
    std::vector<int> ch(n, 0);
    int p = 0;
    int cur = a[i] - 2 * (n - i - 1);
    while (p < fp.size() && cur > fp[p].first + 1) {
      int valm = fp[p].first + 1;
      int r = p + 1;
      while (r < fp.size() && fp[r].first == fp[p].first) r++;
      for (int j = r - 1; j >= p; j--) {
        if (ch[fp[j].second] == 2) break;
        cur--;
        ans[i][fp[j].second]++;
        ans[fp[j].second][i]--;
        fp[j].first++;
        ch[fp[j].second]++;
        if (cur <= valm) break;
      }
      p = r;
    }
    if (cur > 0) {
      cout << "no";
      return 0;
    }
    fp.push_back(make_pair(cur, i));
    sort((fp).begin(), (fp).end());
  }
  int pt = 0;
  if (-fp[0].first > 2 * (n - m)) {
    cout << "no";
    return 0;
  }
  for (auto x : fp) {
    int ind = x.second;
    for (int i = 0; i < -x.first; i++) {
      ans[m + pt][ind]++;
      ans[ind][m + pt]--;
      pt = (pt + 1) % (n - m);
    }
  }
  printf("yes\n");
  for (int i = 0; i < n; i++) {
    string s;
    for (int j = 0; j < n; j++) {
      if (i == j)
        s.push_back('X');
      else if (ans[i][j] == 1)
        s.push_back('W');
      else if (ans[i][j] == -1)
        s.push_back('L');
      else if (ans[i][j] == 0)
        s.push_back('D');
    }
    printf("%s\n", s.c_str());
  }
}
