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.util.* ;
import java.lang.* ;
import java.io.*;
 
public class javaTemplate {
	
	static FastReader sc = new FastReader();
	//	static Scanner sc = new Scanner(System.in) ;
	
	public static void main(String[] args) {
		
		
  
     int n = sc.nextInt() ;
		int k = sc.nextInt() ;
		
		int arr[] = new int[n] ;
		int min = Integer.MAX_VALUE ;
		int max = Integer.MIN_VALUE ;
		for(int i = 0 ; i< n ; i++) {
			arr[i] = sc.nextInt() ;
			if(min > arr[i]) min = arr[i] ;
			if(max < arr[i]) max = arr[i] ;
		}
		
		if(max-min > k) {
			System.out.println("NO");
		} else {
			
			System.out.println("YES");
			String str[] = new String[n] ;
			String s = "" ;
			for(int i = 0 ; i < min ; i++) {
				s += "1 " ;
			}
			
			for(int i = 0 ; i< n ; i++) {
				if(arr[i] != min) {
					str[i] = s + "1 " ;
				} else {
					str[i] = s ;
				}
			}
			int lim = min+1 ;
			int x = 2 ;
			while(x <= k) {
				for(int i = 0 ; i< n ; i++) {
					if(arr[i] != min && arr[i]-lim > 0) {
						str[i] += Integer.toString(x) + " " ;
					}
				}
				lim ++ ;
				x ++ ;
			}
			
			for(int i = 0 ; i< n ; i++) {
				System.out.println(str[i]);
			}
			
		}
		
		
		
		
		
		
		
		
		
		
		
	}
	
 
	
	
 
	
 
	
	
	
 
	
	
	
	
	
	
	 
	
	
 
 
	
	
//_________________________//Template//_____________________________________________________________________
	
	
		//		FAST I/O
		static class FastReader {
	        BufferedReader br;
	        StringTokenizer st;
	        
	        public FastReader()
	        {
	            br = new BufferedReader(
	                new InputStreamReader(System.in));
	        }
	 
	        String next()
	        {
	            while (st == null || !st.hasMoreElements()) {
	                try {
	                    st = new StringTokenizer(br.readLine());
	                }
	                catch (IOException e) {
	                    e.printStackTrace();
	                }
	            }
	            return st.nextToken();
	        }
	 
	        int nextInt() { return Integer.parseInt(next()); }
	 
	        long nextLong() { return Long.parseLong(next()); }
	 
	        double nextDouble()
	        {
	            return Double.parseDouble(next());
	        }
	 
	        String nextLine()
	        {
	            String str = "";
	            try {
	                str = br.readLine();
	            }
	            catch (IOException e) {
	                e.printStackTrace();
	            }
	            return str;
	        }
		}
	
	
		
		
		
		
		
		
		
		// Modulo
		static int mod(int a, int m)
		{
		    return (a%m + m) % m;
		}
		
		
		
		
		
		//		LPS Array
		static void LPSArray(String pat, int M, int lps[]) {
			int i = 1 ;
			int length = 0 ;
			lps[0] = 0 ;
			
			while(i < M) {
				if(pat.charAt(i) == pat.charAt(length)) {
					length ++ ;
					lps[i] = length ;
					i ++ ;
				} else if(length != 0) {
					length = lps[length-1] ;
				} else {
					lps[i] = length ;
					i ++ ;
				}
			}
		}
		
		
		
		//		KMP Search
		static boolean kmpSearch(String pat, String txt) {
			boolean val = false ;
			int M = pat.length() ;
			int N = txt.length() ;
			
			int lps[] = new int[M] ;
			
			int j = 0 ;
			int i = 0 ;
			
			LPSArray(pat,M,lps) ;
			
			while(i < N) {
				if(pat.charAt(j) == txt.charAt(i)) {
					i ++ ;
					j ++ ;
				} else if(j != 0) {
					j = lps[j-1] ;
				} else {
					i ++ ;
				}
				
				if(j == M) {
					 val = true ;
					 j = lps[j-1] ;
				}
			}
			
			return val ;
		}
	
	
		
			
			
		
		
		
		//		Palindrom or Not
		static boolean isPalindrome(StringBuilder str, int low, int high) {
					
					while (low < high) {
						if (str.charAt(low) != str.charAt(high)) return false;
					 	low++;
					 	high--;
					}
					return true;
				}
	
	
		// Euler Tortient fx
	static int Phi(int n) {
		
		int count = 0 ;
		for(int i = 1 ; i< n ; i++) {
			if(GCD(i,n) == 1) count ++ ;
		}
		return count ;
	}
	
	
	
		// Integer Sort
		static void sort(int[] a) 
		   {
				ArrayList<Integer> l=new ArrayList<>();
				for (int i:a) l.add(i);
				Collections.sort(l);
				for (int i=0; i<a.length; i++) a[i]=l.get(i);
			}
	
		
		
		
		// Long Sort
		static void sort(long[] a) 
		   {
				ArrayList<Long> l=new ArrayList<>();
				for (long i:a) l.add(i);
				Collections.sort(l);
				for (int i=0; i<a.length; i++) a[i]=l.get(i);
			}
	
	
		
		// boolean Value
		static void val(boolean val)
	    {
	       System.out.println(val ? "YES" : "NO");
	       System.out.flush();
	    }
	
	
		
	
		// GCD
		public static int GCD(int a , int b) {
				if(b == 0) return a ;
				
				return GCD(b, a%b) ;
			}
	
		
		
		
		
		
		// sieve
		public static boolean [] sieveofEratosthenes(int n) {
			
			boolean isPrime[] = new boolean[n+1] ;
			Arrays.fill(isPrime, true);
			isPrime[0] = false ;
			isPrime[1] = false ;
			
			for(int i = 2 ; i * i <= n ; i++) {
				
				for(int j = 2 * i ; j<= n ; j+= i) {
					isPrime[j] = false ;
				}
			}
			
			return isPrime ;
		}
		
		
		
		
		// fastPower
		public static long fastPowerModulo(long a, long b, long n) {
			
			long res = 1 ;
			
			while(b > 0) {
			if((b&1) != 0) {
				res = (res * a % n) % n ;
			}
			
			a = (a % n * a % n) % n ;
			b = b >> 1 ;
			}
			
			return res ;
		}
	
 
}