Problem: You are given a set S of strings consisting of `0` and `1`, and an integer K.

Find the longest string that is a subsequence of K or more different strings in S. If there are multiple strings that satisfy this condition, find the lexicographically smallest such string.

Here, S is given in the format below:

* The data directly given to you is an integer N, and N+1 strings X_0,X_1,...,X_N. For every i (0\leq i\leq N), the length of X_i is 2^i.
* For every pair of two integers (i,j) (0\leq i\leq N,0\leq j\leq 2^i-1), the j-th character of X_i is `1` if and only if the binary representation of j with i digits (possibly with leading zeros) belongs to S. Here, the first and last characters in X_i are called the 0-th and (2^i-1)-th characters, respectively.
* S does not contain a string with length N+1 or more.



Here, a string A is a subsequence of another string B when there exists a sequence of integers t_1 < ... < t_{|A|} such that, for every i (1\leq i\leq |A|), the i-th character of A and the t_i-th character of B is equal.

Constraints

* 0 \leq N \leq 20
* X_i(0\leq i\leq N) is a string of length 2^i consisting of `0` and `1`.
* 1 \leq K \leq |S|
* K is an integer.

Input

Input is given from Standard Input in the following format:


N K
X_0
:
X_N


Output

Print the lexicographically smallest string among the longest strings that are subsequences of K or more different strings in S.

Examples

Input

3 4
1
01
1011
01001110


Output

10


Input

4 6
1
01
1011
10111010
1101110011111101


Output

100


Input

2 5
0
11
1111


Output

Solution (in CPP):

Solution:
#include<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<vector>
#include<time.h>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=1066667;
const int M=22;
const int INF=1e9+7;
int f[M][N],g[M][N][2],fp[N],t[M][N];
int n,mx=0,m,mi;
char s[N];
void ins(int a,int l){
	if(l<mx)return;
	if(l>mx){
		mi=a;
		mx=l;
		return;
	}
	mi=min(mi,a);
}
void print(int x,int w){
	if(!w)return;
	print(x>>1,w-1);
	putchar('0'+(x&1));
} 
int main(){
	scanf("%d%d",&n,&m);
	rep0(i,n)REP(j,(1<<i),(1<<(i+1))-1)fp[j]=i;
	fp[0]=-1;
	g[0][0][0]=g[0][0][1]=-1;
	rep(i,n){
		rep0(j,(1<<i)){
			if((j>>(i-1))&1){
				g[i][j][1]=i-1;
				g[i][j][0]=fp[j^((1<<i)-1)];
			}
			else{
				g[i][j][0]=i-1;
				g[i][j][1]=fp[j];
			}
		}
	}
	rep0(i,n+1){
		scanf("%s",s);
		rep0(j,(1<<i))f[i][j]=s[j]-'0';
	}
	rep0(i,n){
		rep0(j,(1<<(i+1)))rep0(k,n-i)rep0(l,(1<<k))t[k][l<<(i+1)|j]=0;
		rep0(j,(1<<i)){
			rep(k,n-i){
				rep0(l,(1<<k)){
					if(~g[k][l][0])t[g[k][l][0]][(l%(1<<g[k][l][0]))<<(i+1)|(j*2)]+=f[k][l<<i|j];
					if(~g[k][l][1])t[g[k][l][1]][(l%(1<<g[k][l][1]))<<(i+1)|(j*2+1)]+=f[k][l<<i|j];
				}
			}
		}
		rep0(j,(1<<(i+1))){
			int gg=0;
			rep0(k,n-i){
				rep0(l,(1<<k)){
					f[k][l<<(i+1)|j]=t[k][l<<(i+1)|j];
					gg+=f[k][l<<(i+1)|j];
				}
			}
			if(gg>=m)ins(j,i+1);
		}
	}
	print(mi,mx);
	puts("");
	return 0;
}