#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 123;
void TestCase() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n * k);
  for (auto& x : v) cin >> x;
  vector<int> cnt(n * k + 5, 0);
  vector<int> pre(n * k + 5, -1);
  vector<int> last(n * k + 5, -1);
  vector<pair<int, pair<int, int>>> ans;
  int limit = ((n % (k - 1) == 0) ? n / (k - 1) + 1 : n / (k - 1) + 2);
  for (int i = 0; i < v.size(); i++) {
    if (pre[v[i]] != -1 && last[v[i]] == -1) {
      int L = pre[v[i]];
      int R = i;
      bool ok = true;
      for (int j = L; j <= R; j++) {
        if (cnt[j] == limit - 1) ok = false;
      }
      if (ok) {
        for (int j = L; j <= R; j++) {
          cnt[j]++;
        }
        last[v[i]] = i;
        ans.push_back({v[i], {L + 1, R + 1}});
      }
    }
    pre[v[i]] = i;
  }
  sort(ans.begin(), ans.end());
  for (auto x : ans) {
    cout << x.second.first << ' ' << x.second.second << '\n';
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  TestCase();
}
