/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class GFG {
	public static void main (String[] args) {
		//System.out.println("GfG!");
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int q=sc.nextInt();
		int a[]=new int[n];
		int deg[]=new int[31];
		for(int i=0;i<n;i++){
		    a[i]=sc.nextInt();
		    int value=a[i],count=0;
		    while(value>1){
		        value/=2;
		        count++;
		    }
		    deg[count]++;
		}
		Arrays.sort(a);
        for(int j=0;j<q;j++){
            int count=0;
            int qery=sc.nextInt();
            for(int i=30;i>=0;i--){
                if(qery<=0)
                    break;
                int p=(1<<i);
                int v=Math.min(qery/p,deg[i]);
                if(v>0){
                    System.out.println(v+" "+p);
                    count=count+v;
                    qery=qery-v*(p);
                }
            }
            if(qery==0)
                System.out.println(count);
            else    
            System.out.println(-1);
        }
	}
}