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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.StringTokenizer;

public class Solution {

	void solve() throws IOException {
		int n = io.nextInt();
		int k = io.nextInt();

		int minPile = Integer.MAX_VALUE;
		int maxPile = Integer.MIN_VALUE;

		int[] size = new int[n];

		for (int i = 0; i < n; i++) {
			int x = io.nextInt();
			minPile = Math.min(x, minPile);
			maxPile = Math.max(x, maxPile);
			size[i] = x;
		}

//		minPile++;

		if (maxPile - minPile > k) {
			io.println("NO");
			return;
		}

		io.println("YES");

		for (int i = 0; i < n; i++) {
			int s = size[i];
			for (int j = 1; j <= s; j++) {
				if (j <= minPile) {
					io.print("1 ");
				} else {
					io.print((j - minPile) + " ");
				}
			}
			io.println();
		}

	}

	// ~~~~~~~~~~~~~~~~~~~~~~~ //

	public static void main(String[] args) throws IOException {
		io = new MyIO(null);
		long timeBegin = System.currentTimeMillis();
		new Solution().solve();
		long timeEnd = System.currentTimeMillis();
		System.err.println(timeEnd - timeBegin + " millis");
		io.close();
	}

	static class Geom {

		static final double EPS = 1e-6;

		static int sign(double d) {
			if (Math.abs(d) <= EPS) {
				return 0;
			}
			if (d > 0) {
				return 1;
			} else {
				return -1;
			}
		}

		static class Point {
			double x;
			double y;

			public Point(double x, double y) {
				this.x = x;
				this.y = y;
			}

			public Point add(Vector n) {
				return new Point(x + n.x, y + n.y);
			}

			public Point() {
				x = 0;
				y = 0;
			}

			@Override
			public String toString() {
				return "(" + x + ", " + y + ")";
			}

			double distanceTo(Point b) {
				return Math.sqrt(squareDistanceTo(b));
			}

			double squareDistanceTo(Point b) {
				return (x - b.x) * (x - b.x) + (y - b.y) * (y - b.y);
			}

		}

		static class Vector extends Point {
			public Vector(Point a, Point b) {
				x = b.x - a.x;
				y = b.y - a.y;
			}

			public Vector() {
				super();
			}

			public Vector(double x, double y) {
				this.x = x;
				this.y = y;
			}

			public Vector(Point a) {
				x = a.x;
				y = a.y;
			}

			@Override
			public String toString() {
				return "{" + x + ", " + y + "}";
			}

			public double length() {
				return new Point(0, 0).distanceTo(new Point(x, y));
			}

			public Vector getNormalized() {
				double len = length();
				return new Vector(x / len, y / len);
			}

			public double crossProduct(Vector b) {
				Vector a = this;
				return a.x * b.y - a.y * b.x;
			}

			public double dotProduct(Vector b) {
				Vector a = this;
				return a.x * b.x + a.y * b.y;
			}

		}

		static class Line {
			double a;
			double b;
			double c;

			public Line(Point i, Point j) {
				a = i.y - j.y;
				b = j.x - i.x;
				c = -a * i.x - b * i.y;
			}

			public boolean contains(Point p) {
				return sign(a * p.x + b * p.y + c) == 0;
			}

			public Vector getNormal() {
				return new Vector(a, b).getNormalized();
			}

			public Line(double a, double b, double c) {
				this.a = a;
				this.b = b;
				this.c = c;
			}

			double getX(double y) {
				return (b * y + c) / -a;
			}

			double getY(double x) {
				return (a * x + c) / -b;
			}

			Point intersect(Line l) {
				double z = a * l.b - l.a * b;
				if (sign(z) == 0) {
					return null;
				}
				double x = ((b * l.c) - (l.b * c)) / z;
				double y = ((c * l.a) - (l.c * a)) / z;
				return new Point(x, y);
			}
		}

		static class Polygon {
			ArrayList<Point> points;

			public Polygon() {
				points = new ArrayList<>();
			}

			public Polygon(Collection<Point> col) {
				points = new ArrayList<>(col);
			}

			double area() {
				double ans = 0;
				for (int i = 0; i < points.size(); i++) {
					Vector a = new Vector(points.get(i));
					Vector b;
					if (i == points.size() - 1) {
						b = new Vector(points.get(0));
					} else {
						b = new Vector(points.get(i + 1));
					}
					ans += a.crossProduct(b);
				}
				return Math.abs(ans / 2);
			}

			boolean contains(Point p) {
				int sign = Integer.MIN_VALUE;
				for (int i = 0; i < points.size(); i++) {
					Point a = points.get(i);
					Point b;
					if (i == points.size() - 1) {
						b = points.get(0);
					} else {
						b = points.get(i + 1);
					}
					Vector ab = new Vector(a, b);
					Vector cp = new Vector(a, p);
					if (sign == Integer.MIN_VALUE) {
						sign = sign(ab.crossProduct(cp));
					} else {
						if (sign != sign(ab.crossProduct(cp))) {
							return false;
						}
					}
				}
				return false;
			}

		}

	}

	static MyIO io;

	static class MyIO {
		BufferedReader in;
		PrintWriter out;

		static final String myIn = "input.txt";
		static final String myOut = "output.txt";

		MyIO(String problemName) throws FileNotFoundException {
			if (new File(myIn).exists()) {
				in = new BufferedReader(new FileReader(new File(myIn)));
				out = new PrintWriter(new File(myOut));
				return;
			} else {
				if (problemName == null) {
					in = new BufferedReader(new InputStreamReader(System.in));
					out = new PrintWriter(System.out);
				} else {
					in = new BufferedReader(new FileReader(new File(problemName
							+ ".in")));
					out = new PrintWriter(new File(problemName + ".out"));
				}
			}
		}

		void println(int i) {
			out.println(i);
		}

		void println(Object s) {
			out.println(s);
		}

		void println(long l) {
			out.println(l);
		}

		void print(Object s) {
			out.print(s.toString());
		}

		void print(char c) {
			out.print(c);
		}

		void println() {
			out.println();
		}

		StringTokenizer tkn = new StringTokenizer("");

		void prepareTokenizer() throws IOException {
			while (!tkn.hasMoreTokens()) {
				tkn = new StringTokenizer(nextLine());
			}
		}

		String nextLine() throws IOException {
			return in.readLine();
		}

		String next() throws IOException {
			prepareTokenizer();
			return tkn.nextToken();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		void close() throws IOException {
			in.close();
			out.close();
		}
	}
}