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.*;
     
        import java.math.BigInteger;
    import java.text.DecimalFormat;
    import java.util.*;
     
    //import Submatrix.InputReader;
         
         
         
         public class Main {
        	public static InputReader in;
            public static PrintWriter pw;
         
         
         
        	public static void main(String args[]) {
        		new Thread(null, new Runnable() {
                    public void run() {
                        try{
                            solve();
                        }
                        catch(Exception e){
                            e.printStackTrace();
                        }
                    }
                }, "1", 1 << 26).start();
            }
        	static ArrayList<Integer> g[];
        	static ArrayList<Integer> h[];
        	static boolean visited[];
        	static boolean visit[];
        	static int par[];
        	static int degree[];
        	static int edjes=0;
        	static int start=-1;
        	static int end=-1;
        	static int Total=0;
        	static int time1[];
        	static int time2[];
        	static int glob=0;
        	static long ans[]=new long[1000000];
        	static boolean vis2[][];
        	//static long sum1=0;
        	//static long val[];
            static ArrayList<Integer> levels[];
            static int max=0;
            static int lev=1;
            static ArrayList<Integer> nodes[];
            static ArrayList<Integer> values[];
            static int depth[];
            static boolean found=false;
           // static long sm[];
            static int sum1=0;
            static int pre[][];
            static int subtree[];
           static  int cnt=0;
           static  HashMap<String,Integer> hm;
           static int sm[];
           static int prime[];
           static long mul[];
           static long d[]=new long[1000000];
           static int tot=0;
           static long highest=(long)1e9;
           static int count=0;
            static Stack<Integer> tt=new Stack();
            static long Cardinality[];
            static int k;
            public static void solve(){
        		
        	
        		 in = new InputReader(System.in);
        		 pw = new PrintWriter(System.out);
            int n=in.nextInt();
            int k=in.nextInt();
            int a[]=in.nextIntArray(n);
            int b[][]=new int[n][k];
            for(int i=0;i<n;i++)
            {
            	int avg=a[i]/k;
            	for(int j=0;j<k;j++)
            		b[i][j]=avg;
            	int rem=a[i]-(avg*k);
            	for(int j=0;j<rem;j++)
            		b[i][j]++;
            }
            for(int i=0;i<n;i++)
            {
            	for(int j=i+1;j<n;j++)
            	{
            		for(int l=0;l<k;l++)
            		{
            			if(Math.abs(b[i][l]-b[j][l])>1)
            			{
            				System.out.println("NO");
            				System.exit(0);
            			}
            		}
            	}
            }
            System.out.println("YES");
            for(int i=0;i<n;i++)
            {
            	for(int j=0;j<k;j++)
            	{
            		for(int l=0;l<b[i][j];l++)
            		{
            			System.out.print((j+1)+" ");
            		}
            	}
            	System.out.println();
            }
            }
            public static void rot(int a[])
            {
            	int n = a.length;
        		int temp =a[0];
        		for(int i=1;i<n;i++)
        			a[i-1] = a[i];
        		a[n-1] = temp;
            }
            private static Comparator MyComp() {
				
				return null;
			}
			public static long gcd(long a, long b) {
      		  if (b == 0) return a;
    		  return gcd(b, a%b);
    		}


             static class Pair implements Comparable<Pair>{
            	int now;
            		int aft;
            		//int index;
            		Pair(int ver,int weight){
            	     	this.now=ver;
            			this.aft=weight;
            			//this.index=index;
            			
            		}
            		@Override
            		public int compareTo(Pair o) {
                            
            				return (int)(o.now-now);
            		}
            				
            	}
        	static class InputReader {
         
        		private InputStream stream;
        		private byte[] buf = new byte[8192];
        		private int curChar, snumChars;
        		private SpaceCharFilter filter;
         
        		public InputReader(InputStream stream) {
        			this.stream = stream;
        		}
         
        		public int snext() {
        			if (snumChars == -1)
        				throw new InputMismatchException();
        			if (curChar >= snumChars) {
        				curChar = 0;
        				try {
        					snumChars = stream.read(buf);
        				} catch (IOException e) {
        					throw new InputMismatchException();
        				}
        				if (snumChars <= 0)
        					return -1;
        			}
        			return buf[curChar++];
        		}
         
        		public   int nextInt() {
        			int c = snext();
        			while (isSpaceChar(c))
        				c = snext();
        			int sgn = 1;
        			if (c == '-') {
        				sgn = -1;
        				c = snext();
        			}
        			int res = 0;
        			do {
        				if (c < '0' || c > '9')
        					throw new InputMismatchException();
        				res *= 10;
        				res += c - '0';
        				c = snext();
        			} while (!isSpaceChar(c));
        			return res * sgn;
        		}
         
        		public long nextLong() {
        			int c = snext();
        			while (isSpaceChar(c))
        				c = snext();
        			int sgn = 1;
        			if (c == '-') {
        				sgn = -1;
        				c = snext();
        			}
        			long res = 0;
        			do {
        				if (c < '0' || c > '9')
        					throw new InputMismatchException();
        				res *= 10;
        				res += c - '0';
        				c = snext();
        			} while (!isSpaceChar(c));
        			return res * sgn;
        		}
         
        		public int[] nextIntArray(int n) {
        			int a[] = new int[n];
        			for (int i = 0; i < n; i++)
        				a[i] = nextInt();
        			return a;
        		}
         
        		public String readString() {
        			int c = snext();
        			while (isSpaceChar(c))
        				c = snext();
        			StringBuilder res = new StringBuilder();
        			do {
        				res.appendCodePoint(c);
        				c = snext();
        			} while (!isSpaceChar(c));
        			return res.toString();
        		}
         
        		public boolean isSpaceChar(int c) {
        			if (filter != null)
        				return filter.isSpaceChar(c);
        			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        		}
         
        		public interface SpaceCharFilter {
        			public boolean isSpaceChar(int ch);
        		}
        	}
        }
     

