#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int M[3001][3001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int total = n * (n - 1);
  vector<pair<int, int> > wins(n);
  for (int i = 0; i < m; ++i) {
    cin >> wins[i].first;
    wins[i].second = i;
    total -= wins[i].first;
  }
  if (total < (n - m) * (n - m - 1) || total > (n - m) * wins[m - 1].first) {
    cout << "no\n";
    return 0;
  }
  for (int i = m; i < n; ++i) {
    wins[i].first = (total + n - 1 - i) / (n - i);
    total -= wins[i].first;
    wins[i].second = i;
  }
  cout << "yes\n";
  while (wins[0].first != -1) {
    for (int i = n - 1; i > 0; --i) {
      if (wins[i].first == -1) continue;
      if (wins[0].first >= 2) {
        M[wins[0].second][wins[i].second] = 2;
        wins[0].first -= 2;
      } else if (wins[0].first == 1) {
        M[wins[0].second][wins[i].second] = 1;
        M[wins[i].second][wins[0].second] = 1;
        --wins[i].first;
        --wins[0].first;
      } else {
        M[wins[i].second][wins[0].second] = 2;
        wins[i].first -= 2;
      }
    }
    wins[0].first = -1;
    sort(wins.begin(), wins.end(), greater<pair<int, int> >());
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j)
        cout << "X";
      else if (M[i][j] == 2)
        cout << "W";
      else if (M[i][j] == 1)
        cout << "D";
      else
        cout << "L";
    }
    cout << "\n";
  }
  return 0;
}
