#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> v[105];
  int arr[105];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int used = 0;
  bool change = 0;
  bool stop = 0;
  while (!stop) {
    stop = 1;
    int cur = used + 1;
    change = 0;
    for (int i = 0; i < n; i++) {
      if (arr[i] == 0)
        change = 1;
      else
        arr[i]--, v[i].push_back(cur);
      if (arr[i]) stop = 0;
    }
    used += change;
  }
  if (used > k)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (int i = 0; i < n; i++)
      for (int j = 0; j < v[i].size(); j++)
        cout << v[i][j] << " \n"[j == v[i].size() - 1];
  }
  return 0;
}
