#include <bits/stdc++.h>
using namespace std;
#define ri rd<int>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i)
const int maxS = 1048579;
const int maxN = 23;

template<class T> T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; return f ? x : -x;
}

int n, m;
char str[maxS];
int mas[maxN];
int ln[maxS];
int* f[maxN][maxN];

inline int lb(int x) {
	return x & -x;
}

void print(int s, int len) {
	per (i, len-1, 0) printf("%d", s >> i & 1);
}

int main() {

	n = ri(), m = ri();
	rep (i, 0, n) mas[i] = (1 << i) - 1;
	rep (i, 1, mas[n]) ln[i] = ln[i >> 1] + 1;
	rep (i, 0, n) { 
		rep (j, 0, i) f[i][j] = new int[mas[i]+1];
		scanf("%s", str);
		rep (s, 0, mas[i]) if (str[s] == '1') ++f[i][i][s];
	}
	per (i, n, 0) per (j, i, 1) rep (s, 0, mas[i]) {
		f[i][j-1][s] += f[i][j][s];
		f[i-j][0][s>>j] += f[i][j][s];
		if ((s & mas[j]) == 0 || (s & mas[j]) == mas[j]) continue;
		int d = s >> (j-1) & 1, t;
		if (d == 0) { 
			t = s & mas[j];
			f[i-(j-ln[t])][ln[t]-1][((s & (~mas[j])) >> (j-ln[t])) | t] += f[i][j][s];
		//	print(s, i); printf(" %d -> ", j);
		//	print((((s & (~mas[j])) >> (j-ln[t])) | t), i-(j-ln[t])); printf(" %d\n", ln[t]-1);
		}
		else {
			int p = ln[(~s) & mas[j]];
			t = (s & mas[p]);
			f[i-(j-p)][p-1][((s & (~mas[j])) >> (j-p)) | t] += f[i][j][s];
		//	print(s, i); printf(" %d -> ", j);
		//	print((((s & (~mas[j])) >> (j-p)) | t), i-(j-p)); printf(" %d\n", p-1);
		}
	}
	per (i, n, 0) rep (s, 0, mas[i])
		if (f[i][0][s] >= m) {
			print(s, i);
			puts("");
			exit(0);
		}

	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 <bits/stdc++.h>
using namespace std;
#define ri rd<int>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i)
const int maxS = 1048579;
const int maxN = 23;

template<class T> T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; return f ? x : -x;
}

int n, m;
char str[maxS];
int mas[maxN];
int ln[maxS];
int* f[maxN][maxN];

inline int lb(int x) {
	return x & -x;
}

void print(int s, int len) {
	per (i, len-1, 0) printf("%d", s >> i & 1);
}

int main() {

	n = ri(), m = ri();
	rep (i, 0, n) mas[i] = (1 << i) - 1;
	rep (i, 1, mas[n]) ln[i] = ln[i >> 1] + 1;
	rep (i, 0, n) { 
		rep (j, 0, i) f[i][j] = new int[mas[i]+1];
		scanf("%s", str);
		rep (s, 0, mas[i]) if (str[s] == '1') ++f[i][i][s];
	}
	per (i, n, 0) per (j, i, 1) rep (s, 0, mas[i]) {
		f[i][j-1][s] += f[i][j][s];
		f[i-j][0][s>>j] += f[i][j][s];
		if ((s & mas[j]) == 0 || (s & mas[j]) == mas[j]) continue;
		int d = s >> (j-1) & 1, t;
		if (d == 0) { 
			t = s & mas[j];
			f[i-(j-ln[t])][ln[t]-1][((s & (~mas[j])) >> (j-ln[t])) | t] += f[i][j][s];
		//	print(s, i); printf(" %d -> ", j);
		//	print((((s & (~mas[j])) >> (j-ln[t])) | t), i-(j-ln[t])); printf(" %d\n", ln[t]-1);
		}
		else {
			int p = ln[(~s) & mas[j]];
			t = (s & mas[p]);
			f[i-(j-p)][p-1][((s & (~mas[j])) >> (j-p)) | t] += f[i][j][s];
		//	print(s, i); printf(" %d -> ", j);
		//	print((((s & (~mas[j])) >> (j-p)) | t), i-(j-p)); printf(" %d\n", p-1);
		}
	}
	per (i, n, 0) rep (s, 0, mas[i])
		if (f[i][0][s] >= m) {
			print(s, i);
			puts("");
			exit(0);
		}

	return 0;
}

```