#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  bool taken[900];
  memset(taken, false, sizeof(taken));
  vector<int> child(k);
  for (int i = 0; i < k; i++) {
    cin >> child[i];
    taken[child[i] - 1] = true;
  }
  int count = 0;
  int j = 0;
  for (int i = 0; i < k * n;) {
    if (!taken[i]) {
      cout << i + 1 << ' ';
      taken[i] = true;
      count++;
      i++;
    } else {
      i++;
    }
    if (count == n - 1) {
      cout << child[j++] << endl;
      count = 0;
    }
  }
  return 0;
}
