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
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.concurrent.LinkedBlockingDeque;

import javax.swing.border.Border;

public class a {

	public static long mod = (long) Math.pow(10, 9) + 7;

	private static class node implements Comparable<node> {
		int num;
		int k;
		int dis;

		node(int m, int k, int dix) {
			num = m;
			this.k = k;
			dis = dix;

		}

		@Override
		public int compareTo(node o) {
			if (o.dis < dis)
				return 1;
			else if (o.dis > dis)
				return -1;
			if (o.k > k)
				return 1;
			else if (o.k < k)
				return -1;
			return 0;

		}

	}

	public static class point {
		long x;
		long y;
		long b;

		point(long x, long y, long b) {
			this.x = x;
			this.y = y;
			this.b = b;
		}
	}

	public static int ch(long y) {
		int r = Long.bitCount(y);
		return r;
	}

	public static long gcd(long x, long y) {
		if (y == 0)
			return x;

		return gcd(y, x % y);
	}

	public static boolean ch[] = new boolean[10000005];
	public static ArrayList<Integer> prime = new ArrayList();

	// public static Queue<Integer> pp;

	public static void sieve(int k) {
		ch[0] = ch[1] = true;

		for (int i = 2; i <= k; i++) {
			if (!ch[i]) {
				prime.add(i);
				// pp.add(i);
				for (long j = (long) i * (long) i; j <= k; j += i) {
					ch[(int) j] = true;
				}
			}
		}

	}

	public static long pw(int x, int power, int mod) {
		if (power == 1)
			return x % mod;
		else if (power % 2 == 0)
			return pw((x % mod * x % mod) % mod, power / 2, mod);
		else
			return (pw(x, power - 1, mod) % mod * x % mod) % mod;

	}

	public static String addToString(String a, int index, char b) {
		String ans = "";
		for (int i = 0; i < a.length(); i++) {
			if (i == index) {
				ans += b;
				index = -1;
				i--;
				continue;
			}
			ans += a.charAt(i);
		}
		return ans;
	}

	public static int bit[];

	public static void add(int idx, int cost) {
		while (idx < bit.length) {
			bit[idx] += cost;
			idx += (idx & -idx);
		}

	}

	public static int get(int idx) {
		int res = 0;
		while (idx > 0) {
			res += bit[idx];
			idx -= (idx & -idx);
		}
		return res;
	}

	public static long dp[][];
	public static int a[];
	public static int n;
	public static int t;
	public static int r;

	public static String ch(String cur, String buf) {

		if (cur.length() > buf.length())
			return cur;
		while (cur.length() < buf.length())
			cur += '0';
		for (int i = 0; i < cur.length(); i++) {
			if (cur.charAt(i) > buf.charAt(i))
				return cur;
			else if (cur.charAt(i) < buf.charAt(i))
				break;
		}
		cur += '0';
		return cur;

	}

	public static String ch1(String cur, String buf) {

		if (cur.length() > buf.length())
			return buf;
		while (cur.length() < buf.length())
			return cur;
		for (int i = 0; i < cur.length(); i++) {
			if (cur.charAt(i) > buf.charAt(i))
				return buf;
			else if (cur.charAt(i) < buf.charAt(i))
				return cur;
		}

		return cur;

	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader in = new BufferedReader(new FileReader(
		// "corporate_gifting.txt"));
		StringBuilder qq = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		// PrintWriter out = new PrintWriter(new FileWriter("out.txt"));
		String y[] = in.readLine().split(" ");
		int n = Integer.parseInt(y[0]);
		int k = Integer.parseInt(y[1]);
		int a[] = new int[n];
		y = in.readLine().split(" ");
		int min = Integer.MAX_VALUE;
		int max = -1;
		int index = -1;
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(y[i]);
			max = Math.max(max, a[i]);
			// min = Math.min(a[i], min);
			if (a[i] < min) {
				min = a[i];
				index = i;
			}
		}
		int dif[][] = new int[105][105];
		ArrayList<Integer> ans[] = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			ans[i] = new ArrayList();
		}
		int t = 1;
		for (int i = 0; i < max; i++) {
			for (int j = 0; j < n; j++) {
				if (a[j] > 0) {
					a[j]--;
					ans[j].add(t);
					dif[j][t]++;
				}
			}
			t++;
			if (t > k)
				t = 1;
		}
		
		for (int i = 1; i <= k; i++) {
			for (int j = 0; j < n; j++) {
				for (int j2 = 0; j2 < n; j2++) {
					if(Math.abs(dif[j][i]-dif[j2][i])>1){
						//System.out.println(j+" "+j2+ " "+i);
						System.out.println("NO");
						return ;
					}
				}
			}
		}
		out.println("YES");
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < ans[i].size(); j++) {
				out.print(ans[i].get(j)+" ");
			}
		out.println();
		}
		out.close();

	}
}
