#include<stdio.h>
int dp[22][1048576],dp2[22][1048576];
int len0[22][1048576],len1[22][1048576];
int tmp[1048576];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<(1<<i);j++)
		{
			char c=getchar();
			while(c<'0'||c>'1')
			{
				c=getchar();
			}
			dp[i][j]=c-'0';
			len0[i][j]=-1;
			len1[i][j]=-1;
			for(int k=0;k<i;k++)
			{
				if(j&(1<<k))
				{
					len1[i][j]=k;
				}
				else
				{
					len0[i][j]=k;
				}
			}
		}
	}
	int ansl=-1,ans=0;
	for(int len=0;len<=n;len++)
	{
		for(int i=0;i<(1<<len);i++)
		{
			tmp[i]=0;
		}
		for(int i=len;i<=n;i++)
		{
			for(int j=0;j<(1<<i);j++)
			{
				tmp[j>>(i-len)]+=dp[i][j];
				dp2[i][j]=dp[i][j];
				dp[i][j]=0;
			}
		}
		for(int i=0;i<(1<<len);i++)
		{
			if(tmp[i]>=k)
			{
				ansl=len;
				ans=i;
				break;
			}
		}
		if(ansl<len)
		{
			break;
		}
		for(int i=len;i<=n;i++)
		{
			for(int j=0;j<(1<<i);j++)
			{
				int high=(j>>(i-len));
				int low=(j&((1<<(i-len))-1));
				int l0=len0[i-len][low];
				int l1=len1[i-len][low];
				if(l0>=0)
				{
					int high0=(high<<1);
					int low0=(low&((1<<l0)-1));
					dp[len+1+l0][(high0<<l0)+low0]+=dp2[i][j];
				}
				if(l1>=0)
				{
					int high1=(high<<1)+1;
					int low1=(low&((1<<l1)-1));
					dp[len+1+l1][(high1<<l1)+low1]+=dp2[i][j];
				}
			}
		}
	}
	for(int i=ansl-1;i>=0;i--)
	{
		if(ans&(1<<i))
		{
			putchar('1');
		}
		else
		{
			putchar('0');
		}
	}
	putchar('\n');
	return 0;
}
### Prompt

Create a solution in cpp for 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
#include<stdio.h>
int dp[22][1048576],dp2[22][1048576];
int len0[22][1048576],len1[22][1048576];
int tmp[1048576];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<(1<<i);j++)
		{
			char c=getchar();
			while(c<'0'||c>'1')
			{
				c=getchar();
			}
			dp[i][j]=c-'0';
			len0[i][j]=-1;
			len1[i][j]=-1;
			for(int k=0;k<i;k++)
			{
				if(j&(1<<k))
				{
					len1[i][j]=k;
				}
				else
				{
					len0[i][j]=k;
				}
			}
		}
	}
	int ansl=-1,ans=0;
	for(int len=0;len<=n;len++)
	{
		for(int i=0;i<(1<<len);i++)
		{
			tmp[i]=0;
		}
		for(int i=len;i<=n;i++)
		{
			for(int j=0;j<(1<<i);j++)
			{
				tmp[j>>(i-len)]+=dp[i][j];
				dp2[i][j]=dp[i][j];
				dp[i][j]=0;
			}
		}
		for(int i=0;i<(1<<len);i++)
		{
			if(tmp[i]>=k)
			{
				ansl=len;
				ans=i;
				break;
			}
		}
		if(ansl<len)
		{
			break;
		}
		for(int i=len;i<=n;i++)
		{
			for(int j=0;j<(1<<i);j++)
			{
				int high=(j>>(i-len));
				int low=(j&((1<<(i-len))-1));
				int l0=len0[i-len][low];
				int l1=len1[i-len][low];
				if(l0>=0)
				{
					int high0=(high<<1);
					int low0=(low&((1<<l0)-1));
					dp[len+1+l0][(high0<<l0)+low0]+=dp2[i][j];
				}
				if(l1>=0)
				{
					int high1=(high<<1)+1;
					int low1=(low&((1<<l1)-1));
					dp[len+1+l1][(high1<<l1)+low1]+=dp2[i][j];
				}
			}
		}
	}
	for(int i=ansl-1;i>=0;i--)
	{
		if(ans&(1<<i))
		{
			putchar('1');
		}
		else
		{
			putchar('0');
		}
	}
	putchar('\n');
	return 0;
}
```