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: 
  import java.util.*;
  import java.io.*;
  public class codeforceb
  {
  	
  	public static void main (String[] args) throws java.lang.Exception
      {
  		 /*Arrays.sort(time,new Comparator<Pair>(){
   			public int compare(Pair p1,Pair p2){
   				if(p1.a==p2.a)
   					return p1.b-p2.b;
   				return p1.a-p2.a;
   			}
   		});*/
  	//	Set<Integer> st1=new HashSet<Integer>();
  		ArrayList<Integer> arr2=new ArrayList<Integer>();
  		ArrayList<Integer> arr1=new ArrayList<Integer>();
          Map<Integer,Integer> hm=new HashMap<Integer,Integer>();
  		PrintWriter out=new PrintWriter(System.out);
  		FastReader sc = new FastReader();
          int t=sc.nextInt();
        //  Map<Integer,Integer> hm=new HashMap<>();
          int  i,j,c,d,k,m,n;
          long count=0,sum1=0,a=0,b=0,sum=0,min,max,curr;
          String s="",s1="",s2="";
          //int r[][]= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}
          	//			};
        //  out.println(4*4*4*4*4*4*6);
          
          long pow[]=new long[10];
          pow[0]=1;
          for(i=1;i<=9;i++)
          	pow[i]=pow[i-1]*10;
          while(t-->0) 
          {
          	n=sc.nextInt();
          	k=sc.nextInt();
          	int arr[]=sc.readArray(n);
          	if(n==1 || pow[arr[1]]>k+1)
          		out.println(k+1);
          	else {
          		min=pow[arr[1]]-2;
          		k-=(pow[arr[1]]-2);
          		for(i=1;i<n-1;i++) {
          			
          			long req=pow[arr[i+1]]/pow[arr[i]];
          			//System.out.println(min+" "+k+" "+req);
          			if(req-1<=k)
          			{
          				min+=pow[arr[i]]*(req-1);
          			}
          			else min+=pow[arr[i]]*k;
          			k=k-((int)req-1);
          			if(k<=0)
          				break;
          			
          		}
          		if(k>0) {
          			min+=pow[arr[n-1]]*k;
          		}
          		out.println(min+1);
          	}
          }
         
          out.close();
      }
  	
  	public static long myPow(long x, long n) {
          if(x==0)
              return 0;
          if(n==0)
              return 1;
          if(n==1)
              return x;
          
          long calc=myPow(x,n/2);
          //System.out.println(calc+" "+n/2);
          if(Math.abs(n)%2==0)
              return (calc*calc)%1000000007;
          else 
              return (x*calc*calc)%1000000007;
      }
  		
  		
  	
  	
  	
      static class FastReader 
      { 
          BufferedReader br; 
          StringTokenizer st; 
    
          public FastReader() 
          { 
              br = new BufferedReader(new
                       InputStreamReader(System.in)); 
          } 
          int[] readArray(int n) {
  			int[] a=new int[n];
  			for (int i=0; i<n; i++) a[i]=nextInt();
  			return a;
  		}
          String next() 
          { 
              while (st == null || !st.hasMoreElements()) 
              { 
                  try
                  { 
                      st = new StringTokenizer(br.readLine()); 
                  } 
                  catch (IOException  e) 
                  { 
                      e.printStackTrace(); 
                  } 
              } 
              return st.nextToken(); 
          } 
    
          int nextInt() 
          { 
              return Integer.parseInt(next()); 
          } 
    
          long nextLong() 
          { 
              return Long.parseLong(next()); 
          } 
    
          double nextDouble() 
          { 
              return Double.parseDouble(next()); 
          } 
    
          String nextLine() 
          { 
              String str = ""; 
              try
              { 
                  str = br.readLine(); 
              } 
              catch (IOException e) 
              { 
                  e.printStackTrace(); 
              } 
              return str; 
          } 
      } 
      static class Pair{
      	int a;
      	int b;
      	Pair(int x, int y)
          {
              this.a = x;
              this.b = y;
          }
      }
  	public static int gcd(int a, int b)
  	{
  		if (b == 0)
  	        return a;
  	    return gcd(b, a % b);
  	}
  }