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.math.*;
import java.io.*; 
 public class B{
static int[] dx={-1,1,0,0};
static int[] dy={0,0,1,-1};
    static FastReader scan=new FastReader();
   public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
  static ArrayList<Pair>es;
  static LinkedList<Integer>edges[];
   static boolean prime[];
   static void sieve(int n) 
    { 
        
        prime = new boolean[n+1]; 
        for(int i=0;i<n;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <=n; p++) 
        { 
           
            if(prime[p] == true) 
            { 
                
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = false; 
            } 
        } 
          
        
    }      
     public static int lowerBound(long[] array, int length, long value) {
        int low = 0;
        int high = length;
        while (low < high) {
            final int mid = (low + high) / 2;
            //checks if the value is less than middle element of the array
            if (value <= array[mid]) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        return low;
    }
    public static int upperBound(long[] array, int length, long value) {
        int low = 0;
        int high = length;
        while (low < high) {
            final int mid = low+(high-low) / 2;
            if ( array[mid]>value) {
                high = mid ;
            } else {
                low = mid+1;
            }
        }
        return low;
    }
static long mod(long x,long y)
    {
        if(x<0)
            x=x+(-x/y+1)*y;
        return x%y;
    }    
    static boolean isPowerOfTwo(int n)
{
    if(n==0)
    return false;
 
return (int)(Math.ceil((Math.log(n) / Math.log(2)))) == 
       (int)(Math.floor(((Math.log(n) / Math.log(2)))));
}

  
   
static boolean isprime(long x)
           {
            for(long i=2;i*i<=x;i++)
                if(x%i==0)
                    return false;
                return true;
           }


static int dist(int x1,int y1,int x2,int y2){
return Math.abs(x1-x2)+Math.abs(y1-y2);
}


    static long cuberoot(long x)
    {
        long lo = 0, hi = 1000005;
        while(lo<hi)
        {
            long m = (lo+hi+1)/2;
            if(m*m*m>x)
                hi = m-1;
            else
                lo = m;
        }
        return lo;
    }
     public static int log2(int N) 
    { 
  
        // calculate log2 N indirectly 
        // using log() method 
        int result = (int)(Math.log(N) / Math.log(2)); 
  
        return result; 
    } 
  
    
   
       static long gcd(long a, long b) {
    if(a!=0&&b!=0)
        while((a%=b)!=0&&(b%=a)!=0);
    return a^b;
}
    static long LCM(long a,long b){
    return (Math.abs(a*b))/gcd(a,b);
   }
   public static class comp1 implements Comparator<Pair>{  
public int compare(Pair o1,Pair o2){
return (o2.y-o2.x)-(o1.y-o1.x);
}
  }
  static int n,k;
  static int arr[];
  static boolean ok(int x)
{
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(arr[i]<=x)
            cnt++;
        
    }
    if(cnt==k)
        return true;
    else return false;
}
static boolean isSubSequence(String str1,  
                    String str2, int m, int n) 
    { 
        int j = 0; 
          
        // Traverse str2 and str1, and compare  
        // current character of str2 with first 
        // unmatched char of str1, if matched  
        // then move ahead in str1 
        for (int i = 0; i < n && j < m; i++) 
            if (str1.charAt(j) == str2.charAt(i)) 
                j++; 
  
        // If all characters of str1 were found 
        // in str2 
        return (j == m);  
    } 
    static int goal[],init[];
    static Set<Integer>sol;
    static boolean vis[];

    static void dfs1(int x,int cur,int count,int level)
    {
        vis[x]=true;
        if(cur!=goal[x])
        {
            if(level%2==1)
                count++;
            sol.add(x);
        }
        for(int i:edges[x])
        {
            if(!vis[i])
            {
                if(level%2==1)
                dfs1(i,(count+init[i])%2,count,level+1);
            }
        }
    }
    static void dfs2(int x,int cur,int count,int level)
    {
        vis[x]=true;
        out.println("FUCK");
        if(cur!=goal[x])
        {
            if(level%2==1)
                count++;
            sol.add(x);
        }
        for(int i:edges[x])
        {
            if(!vis[i])
            {
                if(level%2==0)
                dfs2(i,(count+init[i])%2,count,level+1);
            }
        }
    }
  
public static void main(String[] args)  throws Exception 
{
//java.util.Scanner scan=new java.util.Scanner(new File("mootube.in"));
 //PrintWriter out = new PrintWriter (new FileWriter("mootube.out"));
 //scan=new FastReader("input.txt");
 //out = new PrintWriter ("output.txt");
 //System.out.println(~-1);
//System.out.println(2<<5);
    //System.out.println(0^1023);
//System.out.println(3^9);
/*long body[]=new long[(int)2e5+5];
for(long i=0;i<=(long)2e5+4;i++)
body[(int)i]=i*(i+1)/2;*/
  int tt=1;

//tt=scan.nextInt();

 outer:while(tt-->0)
 {
    int n=scan.nextInt(),c=scan.nextInt();
        int arr[]=new int[n];
        int ok[][]=new int[n][c];
        for(int i=0;i<n;i++){
            arr[i]=scan.nextInt();
            int k=0;
            for(int j=0;j<arr[i];j++)
            {
                ok[i][k++]++;
                if(k==c)
                   k=0;
            }
        }

        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++)
              {
               //out.println(ok[i][j]+" "+i+" "+j);
                for(int k=0;k<c;k++)
                {
                    if(Math.abs(ok[i][k]-ok[j][k])>1)
                    {

                        out.println("NO");
                        out.close();
                        return ;
                    }
                    
                }
        }
      }
      out.println("YES");
      for(int i=0;i<n;i++)
      {
        int k=1;
        for(int j=0;j<arr[i];j++)
        {
            out.print(k+" ");
            k++;
            if(k==c+1)
                k=1;

        }
        out.println();
      }
    
    
}


out.close();
    
}
static class dsu{
    static int id[]=new int[5001];
    dsu()
    {
        for(int i=0;i<1000+5;i++)
            id[i]=i;
    }
    static int find(int x)
    {
        if(x==id[x])
            return x;
        return find(id[x]);
    }
    static void connect(int x,int y)
    {
        int p=find(x);
        int q=find(y);
        id[p]=q;
        //id[q]=p;
    }
    static boolean is(int x,int y)
    {
        int p=find(x);
        int q=find(y);
        if(p==q)
            return true;
        else return false;
    }}
static long binexp(long a,long n,long mod)
{
    if(n==0)
        return 1;
    long res=binexp(a,n/2,mod)%mod;
    res=res*res;
    if(n%2==1)
        return (res*a)%mod;
    else 
        return res%mod;
}
static class special implements Comparable<special>{
    int x;
    char id;
    special(int x,char id)
    {
        this.id=id;
       this.x=x;
    }
    public int compareTo(special o)
    {
        
        return x-o.x;
    }
   
}
 public static  long pow(long b, long e) {
            long r = 1;
            while (e > 0) {
                if (e % 2 == 1) r = r * b ;
                b = b * b;
                e >>= 1;
            }
            return r;
        }

private static void sort(int[] arr) {
        List<Integer> list = new ArrayList<>();
        for (int object : arr) list.add(object);
        Collections.sort(list);
        for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
    }
 public static class FastReader {
        BufferedReader br;
        StringTokenizer root;
        
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        FastReader(String filename)throws Exception
        {

            br=new BufferedReader(new FileReader(filename));
        }
 
        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];
 
            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }
 
            return array;
        }
}
public static class Pair implements Comparable<Pair>{
         int x;
         int y;
        
        int id;
        public Pair(){}
        public Pair(int x1, int y1,int id) {
            x=x1;
            y=y1;
            this.id=id;
        }
        public Pair(int x1, int y1) {
            x=x1;
            y=y1;
        
        }
        @Override
        public int hashCode() {
            return (int)(x + 31 * y);
        }
        public String toString() {
            return x + " " + y;
        }
        @Override
        public boolean equals(Object o){
            if (o == this) return true;
            if (o.getClass() != getClass()) return false;
            Pair t = (Pair)o;
            return t.x == x && t.y == y;
        }
        public  int compareTo(Pair o)
        {
        return x-o.x;
        }
}

}