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: /*
                         _oo0oo_
                        o8888888o
                        88" . "88
                        (| -_- |)
                        0\  =  /0
                      ___/`---'\___
                    .' \\|     |// '.
                   / \\|||  :  |||// \
                  / _||||| -:- |||||- \
                 |   | \\\  -  /// |   |
                 | \_|  ''\---/''  |_/ |
                 \  .-\__  '-'  ___/-. /
               ___'. .'  /--.--\  `. .'___
            ."" '<  `.___\_<|>_/___.' >' "".
           | | :  `- \`.;`\ _ /`;.`/ - ` : | |
           \  \ `_.   \_ __\ /__ _/   .-` /  /
       =====`-.____`.___ \_____/___.-`___.-'=====
                         `=---='
   
  */
  
  import java.util.*;
  import java.math.*;
  import java.io.*;
  import java.lang.Math.*;
  
  public class KickStart2020 {
  	 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());
  		}
  
  		float nextFloat() {
  			return Float.parseFloat(next());
  		}
  
  		String nextLine() {
  			String str = "";
  			try {
  				str = br.readLine();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  			return str;
  		}
  	}
  
  	static long gcd(long a, long b) {
  		if (b == 0)
  			return a;
  		return gcd(b, a % b);
  
  	}
  	static long lcm(long a, long b) {
  		return a / gcd(a, b) * b;
  	}
  
  	public static class Pair implements Comparable<Pair> {
  		public int index;
  		public int value;
  
  		public Pair(int index,int value) {
  			this.index = index;
  			this.value = value;
  		}
  
  		@Override
  		public int compareTo(Pair other) {
  			// multiplied to -1 as the author need descending sort order
  			if(other.index < this.index) return 1;
  			else return -1;
  		}
  		@Override
  		public String toString() {
  			return this.index + " " + this.value;
  		}
  	}
  	static boolean isPrime(long d) {
  		if (d == 1)
  			return false;
  		for (int i = 2; i <= (long) Math.sqrt(d); i++) {
  			if (d % i == 0)
  				return false;
  		}
  		return true;
  	}
  	static void decimalTob(int n, int k, Stack<Integer> ss) {
            int x = n % k;
            int y = n / k;
            ss.push(x);
            if(y > 0) {
          	   decimalTob(y, k, ss);
            }
  	}
  	static long powermod(long x, long y, long mod) {
  		long ans = 1;
  		x = x % mod;
  		if (x == 0)
  			return 0;
  		int i = 1;
  		while (y > 0) {
  			if ((y & 1) != 0)
  				ans = (ans * x) % mod;
  			y = y >> 1;
  			x = (x * x) % mod;
  		}
  		return ans;
  	}
  	static long power(long x, long y)
  	{
  	    long res = 1;     // Initialize result
  	  
  	    while (y > 0)
  	    {
  	       
  	        // If y is odd, multiply x with result
  	        if ((y & 1) != 0)
  	            res = res * x;
  	  
  	        // y must be even now
  	        y = y >> 1; // y = y/2
  	        x = x * x;  // Change x to x^2
  	    }
  	    return res;
  	}
  	public static void main(String[] args) throws Exception {
  		FastReader sc = new FastReader();
  		PrintWriter out = new PrintWriter(System.out);
  		int t = sc.nextInt();
  		outerloop:
  			while(t-- > 0) {
  				int n = sc.nextInt();
  				int k = sc.nextInt();
  				int brr[] = new int[n];
  				long arr[] = new long[n];
  				for(int i = 0; i < n; i++) {
  					int a = sc.nextInt();
  					brr[i] = a;
  					arr[i] = (long)Math.pow(10, a);
  				}
  				for(int i = 0; i < n - 1; i++) {
  					arr[i] = (arr[i + 1] - arr[i])/ arr[i];
  				}
  				k++;
  				long sum = 0;
  				for(int i = 0; i < n - 1; i++) {
  					if(k >= arr[i]) {
  						k -= arr[i];
  						sum += arr[i] * (long)Math.pow(10, brr[i]);
  					}
  					else {
  						sum += k * (long)Math.pow(10, brr[i]);
  						k = 0;
  					}
  					if(k == 0) break;
  				}
  				if(k > 0) sum += k * (long)Math.pow(10, brr[n - 1]);
  				
                  out.println(sum);
                }
  		out.close();
  	}
  }