#include <bits/stdc++.h>
using namespace std;
const int MAX = 3024;
char res[MAX][MAX];
void solve(const int test_num) {
  (void)test_num;
  int M, N;
  scanf("%d %d", &M, &N);
  vector<int> arr(N);
  int rem = M * (M - 1);
  for (int& a : arr) {
    scanf("%d", &a);
    rem -= a;
  }
  if (rem < 0) {
    cout << "no\n";
    return;
  }
  for (int i = N; i < M; ++i) {
    arr.push_back((rem + (M - i - 1)) / (M - N));
  }
  if (M > N && arr[N] > arr[N - 1]) {
    cout << "no\n";
    return;
  };
  for (int i = 1, sum = 0; i <= M; ++i) {
    sum += arr[M - i];
    if (sum < i * (i - 1)) {
      cout << "no\n";
      return;
    }
  }
  memset(res, 'W', sizeof(res));
  priority_queue<pair<int, int>> pq;
  for (int i = 0; i < M; ++i) {
    res[i][i] = 'X';
    res[i][M] = '\0';
    while (!pq.empty()) {
      pq.pop();
    }
    for (int j = i + 1; j < M; ++j) {
      pq.push({arr[j], j});
      res[j][i] = 'L';
    }
    int rem = 2 * (M - i - 1) - arr[i];
    while (rem > 0) {
      const int j = pq.top().second;
      pq.pop();
      --arr[j];
      if (res[i][j] == 'W') {
        res[i][j] = res[j][i] = 'D';
        pq.push({arr[j], j});
      } else {
        res[i][j] = 'L';
        res[j][i] = 'W';
      }
      --rem;
    }
  }
  cout << "yes\n";
  for (int i = 0; i < M; ++i) {
    cout << res[i] << '\n';
  }
}
void init() {}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  init();
  int tests = 1;
  for (int test = 1; test <= tests; ++test) {
    solve(test);
  }
  return 0;
}
