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.util.ArrayList;
  import java.util.List;
  import java.util.StringTokenizer;
  
  public class c {
      public static void main(String[] args) throws IOException {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          StringTokenizer st = new StringTokenizer("");
  
          int tc = Integer.parseInt(br.readLine());
          for (int tt = 0; tt < tc; tt++) {
              st = new StringTokenizer(br.readLine());
              int n = Integer.parseInt(st.nextToken());
              int k = Integer.parseInt(st.nextToken());
  
              st = new StringTokenizer(br.readLine());
              List<Integer> list = new ArrayList<>();
              for (; st.hasMoreTokens(); ) {
                  list.add(Integer.parseInt(st.nextToken()));
              }
  
              long[] powers = new long[10];
              powers[0] = 1;
  
              for (int i = 1; i < 10; i++) {
                  powers[i] = powers[i - 1] * 10;
              }
  
  //            if (n == 1) {
  //                //System.out.println(powers[list.get(0)] * k + 1);
  //                if (list.get(0) != 0) {
  //                    System.out.println(1);
  //                } else {
  //                    System.out.println(k + 1);
  //                }
  //                continue;
  //            }
  
              long now = 0; //psum
              //long[] cnt = new long[10];
  
              k++;
              for (int idx = 0; k > 0; idx++) {
                  long herePower = powers[list.get(idx)];
  
                  if (now + 1 < herePower) {  //빠뜨림 1
                      break;
                  }
  
                  if (idx == n - 1) {
                      now += 1L * k * herePower;
                      //now += herePower;
                      k = 0;
                      break;
                  }
  
                  long nxtPower = powers[list.get(idx + 1)];
  
                  long diff = nxtPower - now - 1;
                  long need = diff / herePower;   //need for next level
                  if (diff % herePower != 0) need++;
  
                  if (need > k) {
                      now += 1L * k * herePower;
                      //now += herePower;
                      k -= need;
                      break;
                  } else {
                      now += 1L * need * herePower;
                      k -= need;
                  }
  
  
              }
  
              //빠뜨림 2
              if (k > 0) {
                  for (int i = n - 1; i >= 0; i--) {
                      if (powers[i] > now + 1) continue;
                      else {
                          now += powers[i] * k;
                         // now += powers[i];   //빠뜨림 3
                          break;
                      }
                  }
              }
  
              if (now == 0) now = 1;
              System.out.println(now);
  
          }
      }
  
  
      private static int lowerBound(List<Long> list, long value) {
          int start = 0, end = list.size();
  
          for (; start < end; ) {
              int mid = (start + end) / 2;
              if (list.get(mid) >= value) {
                  end = mid;
              } else {
                  start = mid + 1;
              }
          }
          return end;
      }
  
  
  //    private static final int MAX = (int) 2e5 + 10;
  //    private static final int mod = 998244353;
  //
  //    private static long fastPow(long x, long e) {
  //        if (e == 0) return 1;
  //        if (e % 2 == 1) return (fastPow(x, e - 1) * x) % mod;
  //        else {
  //            long half = fastPow(x, e / 2) % mod;
  //            return (half * half) % mod;
  //        }
  //    }
  
  }