// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

#define getcode(i,j) (((i)>>(j))&1)

char s[1<<21];
int n,k,val[21][1<<21];
int&id(int a,int n,int b,int m){return val[n][a|(b<<n)|(1<<n+m)];}

void out(int msk,int n,char v='\n'){for(int i=n-1;i>=0;i--)putchar(getcode(msk,i)+'0');putchar(v);}

int main()
{
	get2(n,k);
	for(int i=0;i<=n;i++)
	{
		scanf("%s",s);
		for(int j=0;j<(1<<i);j++)if(s[j]=='1')
			id(0,0,j,i)++;
	}
	for(int i=0;i<=n;i++)for(int j=0;j<(1<<i);j++)
	{
		for(int ii=n-i;ii>0;ii--)for(int jj=0;jj<(1<<ii);jj++)
		{
			int v=id(j,i,jj,ii);
//			out(j,i,'[');out(jj,ii,']');printf(" dp= %d\n",v);
			if(!v)continue;
			id(j,i,0,0)+=v;
			for(int t=ii-1;t>=0;t--)if(getcode(jj,t)==0)
			{
				id(j<<1,i+1,jj&(1<<t)-1,t)+=v;
				break;
			}
			for(int t=ii-1;t>=0;t--)if(getcode(jj,t)==1)
			{
				id(j<<1|1,i+1,jj&(1<<t)-1,t)+=v;
				break;
			}
		}
	}
	for(int i=n;i>=0;i--)
	{
		for(int j=0;j<(1<<i);j++)if(id(j,i,0,0)>=k)
		{
			out(j,i);
			exit(0);
		}
	}
	puts("-1");
	return 0;
}
### Prompt

Your challenge is to write a CPP solution to the following 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

### Response

```cpp
// This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

#define getcode(i,j) (((i)>>(j))&1)

char s[1<<21];
int n,k,val[21][1<<21];
int&id(int a,int n,int b,int m){return val[n][a|(b<<n)|(1<<n+m)];}

void out(int msk,int n,char v='\n'){for(int i=n-1;i>=0;i--)putchar(getcode(msk,i)+'0');putchar(v);}

int main()
{
	get2(n,k);
	for(int i=0;i<=n;i++)
	{
		scanf("%s",s);
		for(int j=0;j<(1<<i);j++)if(s[j]=='1')
			id(0,0,j,i)++;
	}
	for(int i=0;i<=n;i++)for(int j=0;j<(1<<i);j++)
	{
		for(int ii=n-i;ii>0;ii--)for(int jj=0;jj<(1<<ii);jj++)
		{
			int v=id(j,i,jj,ii);
//			out(j,i,'[');out(jj,ii,']');printf(" dp= %d\n",v);
			if(!v)continue;
			id(j,i,0,0)+=v;
			for(int t=ii-1;t>=0;t--)if(getcode(jj,t)==0)
			{
				id(j<<1,i+1,jj&(1<<t)-1,t)+=v;
				break;
			}
			for(int t=ii-1;t>=0;t--)if(getcode(jj,t)==1)
			{
				id(j<<1|1,i+1,jj&(1<<t)-1,t)+=v;
				break;
			}
		}
	}
	for(int i=n;i>=0;i--)
	{
		for(int j=0;j<(1<<i);j++)if(id(j,i,0,0)>=k)
		{
			out(j,i);
			exit(0);
		}
	}
	puts("-1");
	return 0;
}
```