#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "{ ";
  for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it)
    os << '\"' << *it << '\"' << (it + 1 == v.end() ? "" : ", ");
  os << " }";
  return os;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> d(n);
  int size = -1;
  for (int i = (0); i < (int)(n); i++) {
    cin >> d[i];
    size = max(size, d[i]);
  }
  vector<vector<int>> count(size + 1);
  for (int i = (0); i < (int)(n); i++) {
    count[d[i]].push_back(i);
  }
  bool ok = true;
  if (count[0].size() != 1) ok = false;
  vector<pair<int, int>> es;
  vector<int> ks(n);
  if (ok) {
    for (int i = (1); i < (int)(count.size()); i++) {
      int cur = count[i].size();
      int prev = count[i - 1].size();
      if (cur == 0) {
        ok = false;
        break;
      }
      int kk = cur / prev + (cur % prev != 0);
      if (i - 1 != 0) kk++;
      ks[i - 1] += kk;
      for (int j = (0); j < (int)(count[i].size()); j++) {
        es.push_back(make_pair(count[i][j], count[i - 1][j % prev]));
      }
    }
    ok &= *max_element((ks).begin(), (ks).end()) <= k;
  }
  if (ok) {
    cout << es.size() << endl;
    for (int i = (0); i < (int)(es.size()); i++) {
      printf("%d %d\n", es[i].first + 1, es[i].second + 1);
    }
  } else {
    cout << -1 << endl;
  }
}
