Problem: There are n piles of pebbles on the table, the i-th pile contains ai pebbles. Your task is to paint each pebble using one of the k given colors so that for each color c and any two piles i and j the difference between the number of pebbles of color c in pile i and number of pebbles of color c in pile j is at most one.

In other words, let's say that bi, c is the number of pebbles of color c in the i-th pile. Then for any 1 ≤ c ≤ k, 1 ≤ i, j ≤ n the following condition must be satisfied |bi, c - bj, c| ≤ 1. It isn't necessary to use all k colors: if color c hasn't been used in pile i, then bi, c is considered to be zero.

Input

The first line of the input contains positive integers n and k (1 ≤ n, k ≤ 100), separated by a space — the number of piles and the number of colors respectively.

The second line contains n positive integers a1, a2, ..., an (1 ≤ ai ≤ 100) denoting number of pebbles in each of the piles.

Output

If there is no way to paint the pebbles satisfying the given condition, output "NO" (without quotes) .

Otherwise in the first line output "YES" (without quotes). Then n lines should follow, the i-th of them should contain ai space-separated integers. j-th (1 ≤ j ≤ ai) of these integers should be equal to the color of the j-th pebble in the i-th pile. If there are several possible answers, you may output any of them.

Examples

Input

4 4
1 2 3 4


Output

YES
1
1 4
1 2 4
1 2 3 4


Input

5 2
3 2 4 1 3


Output

NO


Input

5 4
3 2 4 3 5


Output

YES
1 2 3
1 3
1 2 3 4
1 3 4
1 1 2 3 4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T>
T pwr(T b, T p) {
  T r = 1, x = b;
  while (p) {
    if (p & 1) r *= x;
    x *= x;
    p = (p >> 1);
  }
  return r;
}
template <class T>
T lcm(T a, T b) {
  return (a / __gcd(a, b)) * b;
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
void xswap(T &x, T &y) {
  if (x != y) {
    x ^= y;
    y ^= x;
    x ^= y;
  }
}
template <typename T>
inline bool isOn(T &mask, int pos) {
  return ((mask) & (1LL << pos));
}
template <typename T>
inline T setf(T mask, int pos) {
  return mask = ((mask) & (~(1LL << pos)));
}
template <typename T>
inline T sett(T mask, int pos) {
  return mask = ((mask) | (1LL << pos));
}
template <typename T>
inline T flip(T mask, int pos) {
  return mask = ((mask) ^ (1LL << pos));
}
template <class T1>
void put(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void put(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void put(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void put(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void put(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1>
void putv(vector<T1> e1) {
  for (int i = 0; i < e1.size(); i++)
    (!i ? cout << e1[i] : cout << " " << e1[i]);
  cout << endl;
}
template <class T1>
void puta(T1 arr[], int l) {
  for (int i = 0; i < l; i++) (!i ? cout << arr[i] : cout << " " << arr[i]);
  cout << endl;
}
template <class T1>
bool tk(T1 &e1) {
  return (cin >> e1 ? true : false);
}
template <class T1, class T2>
bool tk(T1 &e1, T2 &e2) {
  return (cin >> e1 >> e2 ? true : false);
}
template <class T1, class T2, class T3>
bool tk(T1 &e1, T2 &e2, T3 &e3) {
  return (cin >> e1 >> e2 >> e3 ? true : false);
}
template <class T1, class T2, class T3, class T4>
bool tk(T1 &e1, T2 &e2, T3 &e3, T4 &e4) {
  return (cin >> e1 >> e2 >> e3 >> e4 ? true : false);
}
long long arr[200];
long long ans[200][200];
int main() {
  long long n, c, def, mn = (0x7f7f7f7f), mx = -(0x7f7f7f7f);
  tk(n, c);
  for (int i = 0; i <= n - 1; ++i) {
    tk(arr[i]);
    mn = min(mn, arr[i]);
    mx = max(mx, arr[i]);
  }
  def = mx - mn;
  if (def > c) {
    put("NO");
    return 0;
  }
  long long tc = 1;
  for (int i = 0; i <= n - 1; ++i) {
    tc = 1;
    for (int j = 0; j <= arr[i] - 1; ++j) {
      if (tc > c) tc = 1;
      ans[i][j] = tc++;
    }
  }
  put("YES");
  for (int i = 0; i <= n - 1; ++i) {
    puta(ans[i], arr[i]);
  }
  return 0;
}