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: //package currentContest;
  
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.util.ArrayDeque;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.HashSet;
  import java.util.Random;
  import java.util.StringTokenizer;
  import java.util.TreeSet;
  
  public class P3 {
  	static final int MAXN = 300001;
      
      // stores smallest prime factor for every number
      static int spf[] = new int[MAXN];
        
      // Calculating SPF (Smallest Prime Factor) for every
      // number till MAXN.
      // Time Complexity : O(nloglogn)
      static void sieve()
      {
          spf[1] = 1;
          for (int i=2; i<MAXN; i++)
        
              // marking smallest prime factor for every
              // number to be itself.
              spf[i] = i;
        
          // separately marking spf for every even
          // number as 2
          for (int i=4; i<MAXN; i+=2)
              spf[i] = 2;
        
          for (int i=3; i*i<MAXN; i++)
          {
              // checking if i is prime
              if (spf[i] == i)
              {
                  // marking SPF for all numbers divisible by i
                  for (int j=i*i; j<MAXN; j+=i)
        
                      // marking spf[j] if it is not
                      // previously marked
                      if (spf[j]==j)
                          spf[j] = i;
              }
          }
      }
        
      // A O(log n) function returning primefactorization
      // by dividing by smallest prime factor at every step
      static ArrayList<Integer> getFactorization(int x)
      {
      	HashSet<Integer> ret = new HashSet<>();
      	ret.add(x);
          while (x != 1)
          {
              ret.add(spf[x]);
              x = x / spf[x];
          }
          ret.add(1);
          return new ArrayList<>(ret);
      }
      static ArrayList<Integer> printDivisors(int n)
      {
          // Note that this loop runs till square root
      	TreeSet<Integer> ret = new TreeSet<>();
          for (int i=1; i<=Math.sqrt(n); i++)
          {
              if (n%i==0)
              {
                  // If divisors are equal, print only one
                  if (n/i == i)
                      ret.add(i);
        
                  else {
                      ret.add(i);
                      ret.add(n/i);
                  }
              }
          }
          return new ArrayList<>(ret);
      }
  	public static void main(String[] args) {
  		// TODO Auto-generated method stub
  		sieve();
  		FastReader sc = new FastReader();
  		int t=sc.nextInt();
  		StringBuilder st = new StringBuilder();
  		while (t-- != 0) {
  			int n=sc.nextInt();
  			long k=sc.nextInt()+1;
  			int a[]=new int[n];
  			for(int i=0;i<n;i++) {
  				a[i]=sc.nextInt();
  			}
  			Arrays.sort(a);
  			long ans=0;
  			for(int i=0;i<n-1;i++) {
  				long possible=(long) Math.pow(10, a[i+1]-a[i])-1;
  				long req=Math.min(k, possible);
  				k=k-req;
  				ans=(long) (ans+req*(long)Math.pow(10, a[i]));
  				if(k==0) {
  					break;
  				}
  			}
  			if(k>0) {
  				ans=(long) (ans+k*(long)Math.pow(10, a[n-1]));
  			}
  			st.append(ans+"\n");
  		}
  		System.out.println(st);
  	}
  
  	static FastReader sc = new FastReader();
  
  	public static void solvegraph() {
  		int n = sc.nextInt();
  
  		int edge[][] = new int[n - 1][2];
  		for (int i = 0; i < n - 1; i++) {
  			edge[i][0] = sc.nextInt() - 1;
  			edge[i][1] = sc.nextInt() - 1;
  		}
  		ArrayList<ArrayList<Integer>> ad = new ArrayList<>();
  		for (int i = 0; i < n; i++) {
  			ad.add(new ArrayList<Integer>());
  		}
  		for (int i = 0; i < n - 1; i++) {
  			ad.get(edge[i][0]).add(edge[i][1]);
  			ad.get(edge[i][1]).add(edge[i][0]);
  		}
  		int parent[] = new int[n];
  		Arrays.fill(parent, -1);
  		parent[0] = n;
  		ArrayDeque<Integer> queue = new ArrayDeque<>();
  		queue.add(0);
  		int child[] = new int[n];
  		Arrays.fill(child, 0);
  		ArrayList<Integer> lv = new ArrayList<Integer>();
  		while (!queue.isEmpty()) {
  			int toget = queue.getFirst();
  			queue.removeFirst();
  			child[toget] = ad.get(toget).size() - 1;
  			for (int i = 0; i < ad.get(toget).size(); i++) {
  				if (parent[ad.get(toget).get(i)] == -1) {
  					parent[ad.get(toget).get(i)] = toget;
  					queue.addLast(ad.get(toget).get(i));
  				}
  			}
  			lv.add(toget);
  		}
  
  		child[0]++;
  	}
  
  	static void sort(int[] A) {
  		int n = A.length;
  		Random rnd = new Random();
  		for (int i = 0; i < n; ++i) {
  			int tmp = A[i];
  			int randomPos = i + rnd.nextInt(n - i);
  			A[i] = A[randomPos];
  			A[randomPos] = tmp;
  		}
  		Arrays.sort(A);
  	}
  
  	static void sort(long[] A) {
  		int n = A.length;
  		Random rnd = new Random();
  		for (int i = 0; i < n; ++i) {
  			long tmp = A[i];
  			int randomPos = i + rnd.nextInt(n - i);
  			A[i] = A[randomPos];
  			A[randomPos] = tmp;
  		}
  		Arrays.sort(A);
  	}
  
  	static String sort(String s) {
  		Character ch[] = new Character[s.length()];
  		for (int i = 0; i < s.length(); i++) {
  			ch[i] = s.charAt(i);
  		}
  		Arrays.sort(ch);
  		StringBuffer st = new StringBuffer("");
  		for (int i = 0; i < s.length(); i++) {
  			st.append(ch[i]);
  		}
  		return st.toString();
  	}
  
  	public static long gcd(long a, long b) {
  		if (a == 0) {
  			return b;
  		}
  		return gcd(b % a, a);
  	}
  
  	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;
  		}
  	}
  }
  