The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Codeforces Round 150 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

implementation

*900

No tag edit access

The problem statement has recently been changed. View the changes.

×
A. Dividing Orange

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputOne 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*_{i} (1 ≤ *a*_{i} ≤ *n*·*k*). All numbers *a*_{i} 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*_{i}for sure; - no segment goes to two children simultaneously.

Help the children, divide the orange and fulfill the requirements, described above.

Input

The first line contains two integers *n*, *k* (1 ≤ *n*, *k* ≤ 30). The second line contains *k* space-separated integers *a*_{1}, *a*_{2}, ..., *a*_{k} (1 ≤ *a*_{i} ≤ *n*·*k*), where *a*_{i} is the number of the orange segment that the *i*-th child would like to get.

It is guaranteed that all numbers *a*_{i} are distinct.

Output

Print exactly *n*·*k* distinct integers. The first *n* integers represent the indexes of the segments the first child will get, the second *n* integers represent the indexes of the segments the second child will get, and so on. Separate the printed numbers with whitespaces.

You can print a child's segment indexes in any order. It is guaranteed that the answer always exists. If there are multiple correct answers, print any of them.

Examples

Input

2 2

4 1

Output

2 4

1 3

Input

3 1

2

Output

3 2 1

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/16/2024 00:22:34 (l3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|