Hanh lives in a shared apartment. There are n people (including Hanh) living there, each has a private fridge. 

n fridges are secured by several steel chains. Each steel chain connects two different fridges and is protected by a digital lock. The owner of a fridge knows passcodes of all chains connected to it. A fridge can be open only if all chains connected to it are unlocked. For example, if a fridge has no chains connected to it at all, then any of n people can open it.

<image> For exampe, in the picture there are n=4 people and 5 chains. The first person knows passcodes of two chains: 1-4 and 1-2. The fridge 1 can be open by its owner (the person 1), also two people 2 and 4 (acting together) can open it.

The weights of these fridges are a_1, a_2, …, a_n. To make a steel chain connecting fridges u and v, you have to pay a_u + a_v dollars. Note that the landlord allows you to create multiple chains connecting the same pair of fridges. 

Hanh's apartment landlord asks you to create exactly m steel chains so that all fridges are private. A fridge is private if and only if, among n people living in the apartment, only the owner can open it (i.e. no other person acting alone can do it). In other words, the fridge i is not private if there exists the person j (i ≠ j) that the person j can open the fridge i.

For example, in the picture all the fridges are private. On the other hand, if there are n=2 fridges and only one chain (which connects them) then both fridges are not private (both fridges can be open not only by its owner but also by another person).

Of course, the landlord wants to minimize the total cost of all steel chains to fulfill his request. Determine whether there exists any way to make exactly m chains, and if yes, output any solution that minimizes the total cost. 

Input

Each test contains multiple test cases. The first line contains the number of test cases T (1 ≤ T ≤ 10). Then the descriptions of the test cases follow.

The first line of each test case contains two integers n, m (2 ≤ n ≤ 1000, 1 ≤ m ≤ n) — the number of people living in Hanh's apartment and the number of steel chains that the landlord requires, respectively.

The second line of each test case contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ 10^4) — weights of all fridges.

Output

For each test case:

  * If there is no solution, print a single integer -1. 
  * Otherwise, print a single integer c — the minimum total cost. The i-th of the next m lines contains two integers u_i and v_i (1 ≤ u_i, v_i ≤ n, u_i ≠ v_i), meaning that the i-th steel chain connects fridges u_i and v_i. An arbitrary number of chains can be between a pair of fridges. 



If there are multiple answers, print any.

Example

Input


3
4 4
1 1 1 1
3 1
1 2 3
3 3
1 2 3


Output


8
1 2
4 3
3 2
4 1
-1
12
3 2
1 2
3 1
import java.util.*;
import java.io.*;
import java.text.DecimalFormat;
public class Exam {
	public static long mod = (long)Math.pow(10, 9)+7 ;
	public static double epsilon=0.00000000008854;//value of epsilon
	public static InputReader sc = new InputReader(System.in);
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void d(int n,int s,int a[],String ans){
		if(a[0]==1){
			return;
		}
		if(n<=0){
			if(Math.sqrt(s)-(int)Math.sqrt(s)==0)
			{
				a[0]=1;
				pw.println(ans);
			}
			return;
		}
		for(int i=1;i<10;i++){
			d(n-1,s+i*i,a,ans+i);
		}
	}
	public static int gr(int s,int e,int a[][],int k,int dp[][]){
		int t=0;
		if(dp[s][k]!=0)
		return dp[s][k];
		if(s==e&&k==0){
			dp[s][k]=1;
			return 1;
		}
		if(k<=0){
			dp[s][k]=0;
			return 0;
		}
		for(int i=0;i<a[s].length;i++){
			if(a[s][i]==1){
				t+=gr(i,e,a,k-1,dp);
			}
		}
		dp[s][k]=t;
		return t;
	}
	public static int f(int n,int k,int v[],int dp[][]){
		
		if(n==0)
		return 0;
		if(n<0||k<=0)
		return -1;
		if(dp[n][k]!=0){
			return dp[n][k];
		}
		int c=f(n-k,k,v,dp);
		if(c==-1){
			dp[n][k]=f(n, k-1, v, dp);
		}
		else{
			dp[n][k]=Math.max(c+v[k-1],f(n, k-1, v, dp));
		}
		return dp[n][k];
	}
	public static int f1(int n,int v[],int dp[]){
		if(n==0)
		return v[0];
		else if(n==1)
		return Math.max(v[0],v[1]);

		if(dp[n]!=0)
		return dp[n];
		else{
			dp[n]=Math.max(f1(n-2,v,dp)+v[n], f1(n-1,v,dp));
			return dp[n];
		}

	}
	public static double dis(int x,int y,int x1[],int y1[],int x2[],int y2[],int x3[],int y3[]){
		double d1[]=new double [x1.length];
		double d2[]=new double [x2.length];
		Arrays.fill(d2,Long.MAX_VALUE);
		for(int i=0;i<x1.length;i++){
			d1[i]=Math.sqrt(Math.pow(x1[i]-x, 2)+Math.pow(y1[i]-y, 2));
		}
		for(int i=0;i<x2.length;i++){
			for(int j=0;j<x3.length;j++){
				d2[i]=Math.min(Math.sqrt(Math.pow(x2[i]-x3[j], 2)+Math.pow(y2[i]-y3[j], 2)), d2[i]);
			}
		}
		double min=Long.MAX_VALUE;
		for(int i=0;i<x1.length;i++){
			for(int j=0;j<x2.length;j++){
				min=Math.min(d1[i]+d2[j]+Math.sqrt(Math.pow(x1[i]-x2[j], 2)+Math.pow(y1[i]-y2[j], 2)), min);
			}
		}
		return min;
	}
	public static void main(String[] args) {
		// code starts..
		int q=sc.nextInt();
		while(q-->0){
			int n=sc.nextInt();
			int m=sc.nextInt();
			int a[]=scanArray(n);
			long c=0;
			if(m<n||n<3)
			{
				pw.println("-1");
				continue;
			}
			Arrays.sort(a);
			for(int i=0;i<n;i++){
				c+=2*a[i];
			}
			c+=(m-n)*(a[0]+a[1]);
			pw.println(c);
			for(int i=0;i<m;i++){
				if(i<n){
					pw.println((i+1)+" "+((i+1)%n+1));
				}
				else pw.println(1+" "+2);
			}
		}
		// Code ends...
		pw.flush();
		pw.close();
	}
	static class tripletL implements Comparable<tripletL> {
		Long x, y, z;

		tripletL(long x, long y, long z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public int compareTo(tripletL o) {
			int result = x.compareTo(o.x);
			if (result == 0)
				result = y.compareTo(o.y);
			if (result == 0)
				result = z.compareTo(o.z);

			return result;
		}

		public boolean equlas(Object o) {
			if (o instanceof tripletL) {
				tripletL p = (tripletL) o;
				return (x - p.x == 0) && (y - p.y ==0 ) && (z - p.z == 0);
			}
			return false;
		}

		public String toString() {
			return x + " " + y + " " + z;
		}

		public int hashCode() {
			return new Long(x).hashCode() * 31 + new Long(y).hashCode() + new Long(z).hashCode();
		}
	}
	public static String Doubleformate(double a){
		DecimalFormat f =new DecimalFormat("#.00");
		return f.format(a);
	}
 
	public static Comparator<Integer[]> column(int i){
		return 
		new Comparator<Integer[]>() {
			@Override
			public int compare(Integer[] o1, Integer[] o2) {
					Integer quantityOne = o1[i];
				Integer quantityTwo = o2[i];
				return quantityOne.compareTo(quantityTwo);
			}
		};
	}
	public static Comparator<Integer[]> pair(){
		return 
		new Comparator<Integer[]>() {
			@Override
			public int compare(Integer[] o1, Integer[] o2) {
				int result=o1[0].compareTo(o2[0]);
				if(result==0)
				result=o1[1].compareTo(o2[1]);
				return result;
			}
		};
	}
	public static Comparator<Long[]> Triplet(){
		return 
		new Comparator<Long[]>() {
			@Override
			public int compare(Long[] o1, Long[] o2) {
					int result=o1[0].compareTo(o2[0]);
					if(result==0)
					result=o1[1].compareTo(o2[1]);
					if(result==0)
					result=o1[2].compareTo(o2[2]);
					return result;
			}
		};
	}
	
	
	public static String reverseString(String s){
		StringBuilder input1 = new StringBuilder(); 
        input1.append(s);  
		input1 = input1.reverse();
		return input1.toString();
	}
	public static int[] scanArray(int n){
		int a[]=new int [n];
		for(int i=0;i<n;i++)
		a[i]=sc.nextInt();
 
		return a;
	}
	public static long[] scanLongArray(int n){
		long a[]=new long [n];
		for(int i=0;i<n;i++)
		a[i]=sc.nextLong();
 
		return a;
	}
	public static String [] scanStrings(int n){
		String a[]=new String [n];
		for(int i=0;i<n;i++)
		a[i]=sc.nextLine();
 
		return a;
	}
	static class InputReader {
 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;
 
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
 
		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
 
		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
 
}