#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int maxnk = 10005;
int a[maxnk];
int used[maxn] = {0};
int x[maxn];
int y[maxn];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n * k; ++i) scanf("%d", &a[i]);
  int ch = 0;
  for (int i = 1; i <= n * k; ++i) {
    if (used[a[i]] == 0) {
      used[a[i]] = 1;
      x[a[i]] = i;
    } else if (used[a[i]] == 1) {
      used[a[i]] = 2;
      y[a[i]] = i;
      ++ch;
    }
    if (ch == (n + (k - 2)) / (k - 1)) {
      for (int j = 1; j <= n; ++j)
        if (used[j] == 1) used[j] = 0;
      ch = 0;
    }
  }
  for (int i = 1; i <= n; ++i) cout << x[i] << ' ' << y[i] << '\n';
  return 0;
}
