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 com.sun.security.jgss.GSSUtil;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.math.BigInteger;
  import java.util.*;
  
  
  public class javacp{
  
  
      static FastReader fs=new FastReader();
      static class FastReader{
          BufferedReader br;
          StringTokenizer st;
          public FastReader(){
              br = new BufferedReader(new InputStreamReader(System.in));
          }
          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;
          }
  
          int[] inputIntArray(int n){
              int[] arr = new int[n];
              for(int i=0;i<n;i++)
                  arr[i] = fs.nextInt();
  
              return arr;
          }
      }
  
      static void sort(int[] arr){
          ArrayList<Integer> al = new ArrayList<>();
          for(int val : arr){
              al.add(val);
          }
  
          Collections.sort(al);
          for(int i=0;i<arr.length;i++){
              arr[i] = al.get(i);
          }
      }
  
      static class Pair implements Comparable<Pair>{
          int src;
          int dest;
          long wt;
  
          Pair(int src,int dest,long wt){
              this.src = src;
              this.dest = dest;
              this.wt = wt;
          }
  
          public int compareTo(Pair pair){
              if(this.wt > pair.wt)
                  return 1;
              else if(this.wt < pair.wt)
                  return -1;
              else
                  return 0;
          }
      }
  
  
      static int[] par1 , rank1 , size;
      static int[] par2;
      static int[] rank2;
  
      static boolean union1(int vt1 , int vt2){
          int parent1 = findParent1(vt1) , parent2 = findParent1(vt2);
          int r1 = rank1[parent1] , r2 =  rank1[parent2];
  
          if(parent1 == parent2) return false;
  
          if(r1 < r2) {
              par1[parent1] = parent2;
              size[parent2] += size[parent1];
          }
          else{
              par1[parent2] = parent1;
              size[parent1] += size[parent2];
          }
  
          if(r1 == r2) rank1[parent1]++;
  
          return true;
      }
  
      static void union2(int vt1 , int vt2){
          int parent1 = findParent2(vt1) , parent2 = findParent2(vt2);
          int r1 = rank2[parent1] , r2 =  rank2[parent2];
  
          if(parent1 == parent2) return;
  
          if(r1 < r2)
              par2[parent1] = parent2;
          else par2[parent2] = parent1;
  
          if(r1 == r2) rank2[parent1]++;
      }
  
      static int findParent1(int vt){
          if(par1[vt] == vt) return vt;
          par1[vt] = findParent1(par1[vt]);
  
          return par1[vt];
      }
  
      static int findParent2(int vt){
          if(par2[vt] == vt) return vt;
          par2[vt] = findParent2(par2[vt]);
  
          return par2[vt];
      }
  
      static void initialise1(int numOfVtces){
          par1 = new int[numOfVtces];
          rank1 = new int[numOfVtces];
          size = new int[numOfVtces];
  
          for(int i=0;i<numOfVtces;i++){
              par1[i] = i;
              rank1[i] = 1;
              size[i] = 1;
          }
      }
  
      static void initialise2(int numOfVtces){
          par2 = new int[numOfVtces];
          rank2 = new int[numOfVtces];
  
          for(int i=0;i<numOfVtces;i++){
              par2[i] = i;
              rank2[i] = 0;
          }
      }
  
  
  
      public static void main(String[] args) throws IOException{
  
          int t = 1;
          t = fs.nextInt();
  
          while (t-- > 0) {
              int n = fs.nextInt() , k = fs.nextInt() + 1;
              int[] arr = fs.inputIntArray(n);
  
              long[] count = new long[n];
              for(int i=0; i<n-1;i++){
                  long val1 = (long) Math.pow(10,arr[i]);
                  long val2 = (long) Math.pow(10,arr[i+1]);
  
                  count[i] = (val2-val1)/val1;
              }
  
              long[] occ = new long[n];
              for(int i=0; i< n-1; i++){
  
                  if(k > count[i]){
                      occ[i] = count[i];
                      k -= count[i];
                  }
                  else{
                      occ[i] = k;
  
                      k = 0;
                      break;
                  }
              }
  
              if(k > 0) {
                  occ[n - 1] = k;
              }
  
              long num = 0;
              for(int i=0; i < n; i++){
                  num += (occ[i] * (long) Math.pow(10,arr[i]));
              }
  
              System.out.println(num);
          }
      }
  
      static int modInverse(int a, int m)
      {
          int m0 = m;
          int y = 0, x = 1;
  
          if (m == 1)
              return 0;
  
          while (a > 1) {
              // q is quotient
              int q = a / m;
  
              int t = m;
  
              // m is remainder now, process
              // same as Euclid's algo
              m = a % m;
              a = t;
              t = y;
  
              // Update x and y
              y = x - q * y;
              x = t;
          }
  
          // Make x positive
          if (x < 0)
              x += m0;
  
          return x;
      }
  
      static int mod = 1000000007;
      static long  power(long a,long b,long m) {
          a %= m;
          long res = 1;
          while (b > 0) {
              if ((b & 1) == 1)
                  res = res * a % m;
              a = a * a % m;
              b >>= 1;
          }
          return res;
      }
  
      static class CustomSort implements Comparator<int[]> {
  
          public int compare(int[] a, int[] b)
          {
              return a[0] - b[0];
          }
      }
  
      static void printArr(int[] arr){
          for(int i=0;i< arr.length;i++)
          {
              System.out.print(arr[i] + " ");
          }
          System.out.println();
      }
  
      private static int lcm(int a, int b) {
          int gcd = gcd(a,b);
          return (int)((long)a*(long)b)/gcd ;
      }
  
  
      private static int gcd(int a, int b) {
          if(b == 0) return a;
          else return gcd(b , a % b);
      }
  
  
      private static void swap(int[] arr, int start, int rand_pivot) {
          int temp = arr[start];
          arr[start] = arr[rand_pivot];
          arr[rand_pivot] = temp;
      }
  
  
  }