One day Ms Swan bought an orange in a shop. The orange consisted of *n*·*k* segments, numbered with integers from 1 to *n*·*k*. 

There were *k* children waiting for Ms Swan at home. The children have recently learned about the orange and they decided to divide it between them. For that each child took a piece of paper and wrote the number of the segment that he would like to get: the *i*-th (1 ≤ *i* ≤ *k*) child wrote the number *a*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ *n*·*k*). All numbers *a*<sub class="lower-index">*i*</sub> accidentally turned out to be different.

Now the children wonder, how to divide the orange so as to meet these conditions:
 -  each child gets exactly *n* orange segments; -  the *i*-th child gets the segment with number *a*<sub class="lower-index">*i*</sub> for sure; -  no segment goes to two children simultaneously. 
Help the children, divide the orange and fulfill the requirements, described above.
The first line contains two integers *n*, *k* (1 ≤ *n*, *k* ≤ 30). The second line contains *k* space-separated integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*k*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ *n*·*k*), where *a*<sub class="lower-index">*i*</sub> is the number of the orange segment that the *i*-th child would like to get.

It is guaranteed that all numbers *a*<sub class="lower-index">*i*</sub> are distinct.
from sys import stdin,stdout
from math import log2,ceil,floor
from copy import deepcopy
import bisect,sys
input=stdin.readline
isIo=False
if(isIo):
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
def printend(*argv):
    output=""
    for arg in argv: output+=str(arg)+" "
    stdout.write(output)
def print(*argv):
    output=""
    for arg in argv: output+=str(arg)+" "
    stdout.write(output+"\n")

def findSet(ump,u):
    r=u
    while(ump[r]>=0):
        r=ump[r]
    while(u != r):
        par=ump[u]
        ump[u]=r
        u=par
    return r
def setUnion(ump,u,v):
    u=findSet(ump,u)
    v=findSet(ump,v)
    if(u==v): return False
    totalChilds=ump[u]+ump[v]
    if(ump[u]<=ump[v]):
        ump[v]=u
        ump[u]=totalChilds
    else :
        ump[u]=v
        ump[v]=totalChilds
    return True
def preferedUnion(ump,u,v):
    u=findSet(ump,u)
    v=findSet(ump,v)
    if(u==v): return False
    totalChilds=ump[u]+ump[v]
    ump[v]=u
    ump[u]=totalChilds
    return True

n,k=map(int,input().split())
lst=list(map(int,input().split()))
ump=[-1 for _ in range(int(n*k) + 2)]
place=[deepcopy([]) for _ in range(k)]
for i in range(k):
    preferedUnion(ump,lst[i]+1,lst[i])
    place[i].append(lst[i])
iterations=int(n*k)-k
for i in range(iterations):
    num=findSet(ump,1)
    preferedUnion(ump,num+1,num)
    place[(num-1)//n].append(num)
# print(place)
for i in range(k):
    for j in range(n):
        printend(place[i][j])
    print()

    
