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.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.io.PrintWriter;
  import java.util.StringTokenizer;
  
  public class C_Banknotes {
  
  	 static Scanner in=new Scanner();
      
      static PrintWriter out=new PrintWriter( new OutputStreamWriter(System.out) );
  
      static int n,k,testCases;
      
      static long a[];
      
      static void solve(){
          
          ++k;
          
          long ans=0;
          
          for(int i=0;i<n-1;i++){
              
              if(k>0){
                  
                  long x=(long)Math.pow(10, a[i+1]-a[i]  )-1;
                  
                  long value=Math.min(x,k);
                  
                  ans+=(long)Math.pow(10,a[i])*value;
                  
                  k-=value;
                  
              }
              
          }
          
          ans+=(long)Math.pow(10,a[n-1])*k;
          
          out.println(ans);
          out.flush();
          
      }
      
      public static void main(String[] args) throws IOException {
          
          testCases=in.nextInt();
          
          for(int t=0;t<testCases;t++){
              
              n=in.nextInt();
              
              k=in.nextInt();
              
              a=new long[n];
              
              for(int i=0;i<n;i++){
                  
                  a[i]=in.nextLong();
                  
              }
              
              solve();
              
          }
          
          in.close();
          
      }
      static long gcd(long a, long b)
      {
        if (b == 0)
          return a;
        return gcd(b, a % b);
      }
  	
     static void merge(long a[],int left,int right,int mid){
          
          int n1=mid-left+1,n2=right-mid;
          
          long L[]=new long[n1];
          
          long R[]=new long[n2];
          
          for(int i=0;i<n1;i++){
              
              L[i]=a[left+i];
              
          }
          
          for(int i=0;i<n2;i++){
              
              R[i]=a[mid+1+i];
              
          }
          
          int i=0,j=0,k1=left;
          
          while(i<n1 && j<n2){
              
              if( L[i]<=R[j] ){
                  
                  a[k1]=L[i];
                  
                  i++;
                  
              }else{
                  
                  a[k1]=R[j];
                  
                  j++;
                  
              }
              
              k1++;
              
          }
          
          while(i<n1){
              
              a[k1]=L[i];
              
              i++;
              
              k1++;
              
          }
          
          while(j<n2){
              
              a[k1]=R[j];
              
              j++;
              k1++;
              
          }
          
      }
      
      static void sort(long a[],int left,int right){
          
          if(left>=right){
              
              return;
              
          }
          
          int mid=(left+right)/2;
          
          sort(a,left,mid);
          
          sort(a,mid+1,right);
          
          merge(a,left,right,mid);
          
      }
  	
  	  static class Scanner{
          
          BufferedReader in;
          StringTokenizer st;
  
          public Scanner() {
          
              in=new BufferedReader( new InputStreamReader(System.in) );
              
          }
          
          String next() throws IOException{
              
              while(st==null || !st.hasMoreElements()){
                  
                  st=new StringTokenizer(in.readLine());
                  
              }
              
              return st.nextToken();
              
          }
          
          int nextInt() throws IOException{
              
              return Integer.parseInt(next());
              
          }
          
          long nextLong() throws IOException{
              
              return Long.parseLong(next());
              
          }
          
          String nextLine() throws IOException{
              
              return in.readLine();
              
          }
          
          char nextChar() throws IOException{
              
              return next().charAt(0);
              
          }
          
          double nextDouble() throws IOException{
              
              return Double.parseDouble(next());
              
          }
          
          float nextFloat() throws IOException{
              
              return Float.parseFloat(next());
              
          }
          
          boolean nextBoolean() throws IOException{
              
              return Boolean.parseBoolean(next());
              
          }
          
  		
          void close() throws IOException{
              
              in.close();
              
          }
          
      }
  	
  }
  /*
  
  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
  
  
  */