#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const int MAXN = 3001;
int a[MAXN];
void no() {
  cout << "no" << endl;
  exit(0);
}
pair<int, int> b[MAXN];
vector<int> c[2 * MAXN];
int ans[MAXN][MAXN];
priority_queue<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int lf = (n * (n - 1));
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    lf -= a[i];
  }
  if (lf < 0) no();
  for (int i = m; i < n; i++) {
    a[i] = (lf + (n - i - 1)) / (n - m);
  }
  if ((m < n) && (a[m] > a[m - 1])) no();
  int s = 0;
  for (int i = n - 1; i >= 0; i--) {
    s += a[i];
    if (s < (n - i) * (n - i - 1)) no();
  }
  for (int i = 0; i < n; i++) c[a[i]].push_back(i);
  cout << "yes\n";
  for (int i = 0; i < n; i++) {
    while (!q.empty()) q.pop();
    for (int j = i + 1; j < n; j++) q.push(make_pair(a[j], j)), ans[i][j] = 2;
    for (int j = 0; j < 2 * (n - i - 1) - a[i]; j++) {
      while (true) {
        int v = q.top().second;
        q.pop();
        if (ans[i][v] != 0) {
          ans[i][v]--;
          a[v]--;
          q.push(make_pair(a[v], v));
          break;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i > j) ans[i][j] = 2 - ans[j][i];
      if (i == j)
        cout << 'X';
      else if (ans[i][j] == 2)
        cout << 'W';
      else if (ans[i][j] == 1)
        cout << 'D';
      else
        cout << 'L';
    }
    cout << '\n';
  }
  return 0;
}
