#include <bits/stdc++.h>
using namespace std;
int n, a, m;
struct koor {
  int i, ch;
};
map<int, bool> pizda;
bool cmp(koor a, koor b) { return a.ch < b.ch; }
koor t;
int z;
vector<koor> q;
int main() {
  ios_base::sync_with_stdio(false), cout.tie(), cin.tie();
  cin >> n;
  for (int i = 1; i <= n; ++i) pizda[i] = false;
  cin >> z;
  long long sum = 0;
  vector<pair<int, int> > ans;
  for (int i = 0; i < n - 1; ++i) {
    cin >> a;
    t.ch = a;
    t.i = i + 2;
    q.push_back(t);
  }
  sort(q.begin(), q.end(), cmp);
  pizda[1] = true;
  for (int i = 0; i < min(z, n - 1); ++i) {
    sum++;
    ans.push_back(make_pair(1, q[q.size() - i - 1].i));
    pizda[q[q.size() - i - 1].i] = true;
  }
  for (int i = q.size(); i > 1; --i) {
    int h = max(i - q[i - 1].ch, 1);
    for (int j = i - 1; j >= h; --j) {
      if (pizda[q[j - 1].i] == false) {
        sum++;
        ans.push_back(make_pair(q[i - 1].i, q[j - 1].i));
        pizda[q[j - 1].i] = true;
      } else {
        h = max(h - 1, 1);
      }
    }
  }
  int w = 0;
  for (auto &i : pizda)
    if (i.second == false) {
      cout << "-1";
      return 0;
    }
  cout << sum << "\n";
  for (int i = 0; i < ans.size(); ++i)
    cout << ans[i].first << " " << ans[i].second << "\n";
  return 0;
}
