#include <bits/stdc++.h>   using namespace std;   int main() {     long long t;     cin >> t;     while (t--) {       long long n, m;       cin >> n >> m;       long long s = 0;       for (long long i = 0; i < n; i++) {         long long a;         cin >> a;         s += 2 * a;       }       if (n == m && n > 2) {         cout << s << endl;         for (long long i = 1; i < n; i++) cout << i <<     << i + 1 << endl;         cout << n <<     << 1 << endl;       } else         cout <<  -1 n ;     }   }   