description: In Berland, n different types of banknotes are used. Banknotes of the i-th type have denomination 10^{a_i} burles (burles are the currency used in Berland); the denomination of banknotes of the first type is exactly 1.
  
  Let's denote f(s) as the minimum number of banknotes required to represent exactly s burles. For example, if the denominations of banknotes used in Berland are 1, 10 and 100, then f(59) = 14: 9 banknotes with denomination of 1 burle and 5 banknotes with denomination of 10 burles can be used to represent exactly 9 ⋅ 1 + 5 ⋅ 10 = 59 burles, and there's no way to do it with fewer banknotes.
  
  For a given integer k, find the minimum positive number of burles s that cannot be represented with k or fewer banknotes (that is, f(s) > k).
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10^4) — number of test cases.
  
  The first line of each test case contains two integers n and k (1 ≤ n ≤ 10; 1 ≤ k ≤ 10^9).
  
  The next line contains n integers a_1, a_2, ..., a_n (0 = a_1 < a_2 < ... < a_n ≤ 9).
  
  Output
  
  For each test case, print one integer — the minimum positive number of burles s that cannot be represented with k or fewer banknotes.
  
  Example
  
  Input
  
  
  4
  3 13
  0 1 2
  2 777
  0 4
  3 255
  0 1 3
  10 1000000000
  0 1 2 3 4 5 6 7 8 9
  
  
  Output
  
  
  59
  778
  148999
  999999920999999999
solution: /*==========================================================================
  *   	AUTHOR:    RonWonWon
  *   	CREATED:   29.10.2021 20:02:06        
  /*==========================================================================*/
  import java.io.*;
  import java.util.*;
  
  public class C {
  	
  	public static void main(String[] args) throws IOException {
  		/*
      in.ini();
      PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
      */
      long startTime = System.nanoTime();
      int t = in.nextInt(), T = 1;  
      while(t-->0) { 
        int n = in.nextInt(), k = in.nextInt()+1;
        int a[] = in.readArray(n);
        long b[] = new long[n];
        for(int i=0;i<n;i++) b[i] = (long)Math.pow(10L,a[i]);
        long cur = 0, prev = 1, val = 0;
        int ind = 0;
        while(true){
        	if(ind+1==n){
        		long diff = k-val;
        		k -= diff;
        		out.print(diff);
        		while(ind>0){
        			ind--;
        			long next = b[ind+1]/b[ind]-1;
        			if(k-next>=0) out.print(next);
        			else{
        				int digits = 0;
        				long c = next;
        				while(c!=0){
        					c/=10; digits++;
        				}
        				char ch[] = new char[digits];
        				for(int i=digits-1;i>=0;i--){
        					ch[i] = (char)('0'+(k%10));
        					k/=10;
        				}
        				out.print(new String(ch));
        			}
        		}
        		break;
        	}
        	else{
        		long next = b[ind+1]/b[ind]-1;
        		if(val+next>=k){
        			long diff = k-val;
        			k -= diff;
          		out.print(diff);
          		while(ind>0){
          			ind--;
          			next = b[ind+1]/b[ind]-1;
          			if(k-next>=0) out.print(next);
          			else{
          				int digits = 0;
          				long c = next;
          				while(c!=0){
          					c/=10; digits++;
          				}
          				char ch[] = new char[digits];
          				for(int i=digits-1;i>=0;i--){
          					ch[i] = (char)('0'+(k%10));
          					k/=10;
          				}
          				out.print(new String(ch));
          			}
          		}
        			break;
        		}
        		prev = b[ind];
        		val += next;
        	}
        	ind++; 
        }
        out.println();
     		//out.println("Case #"+T+": "+ans); T++;
      }
      /*
      startTime = System.nanoTime() - startTime;
      System.err.println("Time: "+(startTime/1000000));
      */
      out.flush();
  	}
  	
  	static FastScanner in = new FastScanner();
    static PrintWriter out = new PrintWriter(System.out);
  	static int oo = Integer.MAX_VALUE;
  	static long ooo = Long.MAX_VALUE;
  	
  	static class FastScanner {
  		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  		StringTokenizer st = new StringTokenizer("");
  		
  		void ini() throws FileNotFoundException {
  			br = new BufferedReader(new FileReader("input.txt"));
  		}
  		
  		String next() {
  			while(!st.hasMoreTokens())
  				try { st = new StringTokenizer(br.readLine()); }
  				catch(IOException e) {}
  			return st.nextToken();
  		}
  		
  		String nextLine(){
  			try{ return br.readLine(); } 
  			catch(IOException e) { } return "";
  		}
  		
  		int nextInt() {
  			return Integer.parseInt(next());
  		}
  		
  		int[] readArray(int n) {
  			int a[] = new int[n];
  			for(int i=0;i<n;i++) a[i] = nextInt();
  			return a;
  		}
  		
  		long nextLong() {
  			return Long.parseLong(next());
  		}
  		
  		long[] readArrayL(int n) {
  			long a[] = new long[n];
  			for(int i=0;i<n;i++) a[i] = nextLong();
  			return a;
  		}
  		
  		double nextDouble() {
  			return Double.parseDouble(next());
  		}
  		
  		double[] readArrayD(int n) {
  			double a[] = new double[n];
  			for(int i=0;i<n;i++) a[i] = nextDouble();
  			return a;
  		}
  	}
  
  	static final Random random = new Random();
  
  	static void ruffleSort(int[] a){
  		int n = a.length;
  		for(int i=0;i<n;i++){
  			int j = random.nextInt(n), temp = a[j];
  			a[j] = a[i]; a[i] = temp;
  		}
  		Arrays.sort(a); 	
  	}
  	
  	static void ruffleSortL(long[] a){
  		int n = a.length;
  		for(int i=0;i<n;i++){
  			int j = random.nextInt(n);
  			long temp = a[j];
  			a[j] = a[i]; a[i] = temp;
  		}
  		Arrays.sort(a); 	
  	}
  }
  