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 : RegalBeast
  
  import java.io.*;
  import java.util.*;
  import java.util.concurrent.*;
  
  public class Main implements Runnable {
    static Input in = new Input();
    static PrintWriter out = Output();
    
    public static void main(String[] args) {
      new Thread(null, new Main(), String.join(
                                    "All that is gold does not glitter,",
                                    "Not all those who wander are lost;",
                                    "The old that is strong does not wither,",
                                    "Deep roots are not reached by the frost.",
                                    
                                    "From the ashes a fire shall be woken,",
                                    "A light from the shadows shall spring;",
                                    "Renewed shall be blade that was broken,",
                                    "The crownless again shall be king."
                                  ), 1<<25).start();
    }
  
    public void run() {
      int tests = in.nextInt();
      for (int t = 0; t < tests; t++) {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] pows = new int[n];
        for (int i = 0; i < n; i++) {
          pows[i] = in.nextInt();
        }
  
        long ans = getAns(pows, k);
        out.println(ans);
      }
      
      in.close();
      out.close();
    }
  
    private static long getAns(int[] pows, int k) {
      if (pows.length == 1) {
        return k+1;
      }
  
      long max = 1L;
      int prev = 0;
  
      for (int i = 0; i < pows.length; i++) {
        long num = (long) Math.pow(10, pows[i]);
        long rem = num - 1;
        if (i + 1 == pows.length) {
          if (prev == k) {
            return num + rem;
          } else {
            long mul = (k-prev+1);
            return num * mul + rem;
          }
        } else {
          int next =(int)(prev + (long) Math.pow(10, pows[i+1]) / num - 1);
          if (true) {
            // out.println(i + " " + next + " NEXT");
          }
          if (next > k) {
            long mul = (k-prev+1);
            return num * mul + rem;
          }
          prev = next;
        }
      }
      return -1;
    }
    
    static PrintWriter Output() {
      return new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    }
    
    static PrintWriter Output(String fileName) {
      PrintWriter pw = null;
      try {
        pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName)));
      } catch (IOException ex) {
        ex.printStackTrace();
      }
      return pw;
    }
  }
  
  class Input {
    BufferedReader br;
    StringTokenizer st;
    public Input() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    public Input(String fileName) {
      try {
        br = new BufferedReader(new FileReader(fileName));
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
  
    public String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException ex) {
          ex.printStackTrace();
        }
      }
      return st.nextToken();
    }
  
    public int nextInt() {
      return Integer.parseInt(next());
    }
  
    public long nextLong() {
      return Long.parseLong(next());
    }
  
    public Float nextFloat() {
      return Float.parseFloat(next());
    }
  
    public Double nextDouble() {
      return Double.parseDouble(next());
    }
  
    public String nextLine() {
      if (st != null && st.hasMoreElements()) {
        StringBuilder sb = new StringBuilder();
        while (st.hasMoreElements()) {
          sb.append(next());
        }
        return sb.toString();
      }
  
      String str = null;
      try {
        str = br.readLine();
      } catch (IOException ex) {
        ex.printStackTrace();
      }
      return str;
    }
  
    public void close() {
      try {
        br.close();
      } catch (IOException ex) {
        ex.printStackTrace();
      }
    }
  }
  