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.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Test
{   
    private static int[] pebbles = new int[200];
    private static List<Integer>[] colors = (List<Integer>[]) new ArrayList[200];
    
    // 用来排序的Element类
    private static class Element implements Comparable<Element>
    {
        public int index;
        public int num;
        
        public Element(int index , int num)
        {
            this.index = index;
            this.num = num;
        }

        @Override
        public int compareTo(Element e) 
        {
            if (num < e.num)
                return - 1;
            else if (num > e.num)
                return 1;
            else
                return 0;
        }
        
    }
    
    // srm 279
    public static void main(String[] args)
    {       
        // 初始化
        init();
        
        Scanner scan = new Scanner(System.in);
        int i , n , k , color = 1;
        n = scan.nextInt();
        k = scan.nextInt();
        for (i = 0;i < n;i ++)
            pebbles[i] = scan.nextInt();
        // 每次找最小值，要判断是否有为0的元素
        while (color <= k && !isEnd(n))
        {
            update(color , n);
            color ++;
        }
        // 如果是最后的结果
        if (isEnd(n))
        {
            System.out.println("YES");
            // 进行结果的输出
            for (i = 0;i < n;i ++)
            {
                boolean first = true;
                // 进行颜色的输出
                for (Integer c : colors[i])
                {
                    if (first)
                        first = false;
                    else
                        System.out.print(" ");
                    System.out.print(c);
                }
                System.out.println();
            }
        }
        // 如果失败了
        else
            System.out.println("NO");
    }
    
    // 判断是否全是0
    private static boolean isEnd(int n)
    {
        for (int i = 0;i < n;i ++)
        {
            if (pebbles[i] != 0)
                return false;
        }
        return true;
    }
    
    // 进行更新
    private static void update(int color , int n)
    {
        List<Element> list = new ArrayList<Element>();
        for (int i = 0;i < n;i ++)
            list.add(new Element(i , pebbles[i]));
        Collections.sort(list);
        // 如果存在为0的，其它的只能取1
        if (list.get(0).num == 0)
        {
            // 遍历列表的每个元素
            for (Element element : list)
            {
                if (element.num > 0)
                {
                    pebbles[element.index] --;
                    colors[element.index].add(color);
                }
            }
        }
        // 如果没有为0的，可以全部取min，且可以额外进行减少
        else
        {
            int min = list.get(0).num;
            for (int i = 0;i < list.size();i ++)
            {
                for (int j = 0;j < min;j ++)
                    colors[list.get(i).index].add(color);
            }
            for (int i = 0;i < list.size();i ++)
            {
                pebbles[list.get(i).index] -= min;
                if (list.get(i).num > min)
                {
                    colors[list.get(i).index].add(color); 
                    pebbles[list.get(i).index] --; 
                }
            }
        }
    }
    
    // 初始化
    private static void init()
    {
        for (int i = 0;i < 150;i ++)
            colors[i] = new ArrayList<Integer>();
    }
    
}