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:
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;

char sl[(1<<20)+5];

int n, k;

string best = "x";

//~ pair<int,int> pre[1<<20][

void consider(string s) {
	reverse(s.begin(), s.end());
	if(best == "x" || s.length() > best.length() || (s.length() == best.length() && s < best))
		best = s;
}

void rec(const vector<int> & w, int S, string already) {
	if(S < k) return;
	consider(already);
	for(int bit : {0, 1}) {
		int s_here = 0;
		vector<int> w2(w.size() / 2);
		for(int L = 0; (1 << L) < (int) w.size(); ++L)
			for(int i = 0; i < (1 << L); ++i) {
				int times = w[(1<<L)+i];
				if(!times) continue;
				int len = L;
				int x = i;
				while(len > 0 && (x % 2 != bit)) {
					x /= 2;
					--len;
				}
				if(!len) continue;
				--len;
				x /= 2;
				debug() << imie(len);
				debug() << imie(1 << len) imie(x) imie(w2.size());
				w2[(1<<len)+x] += times;
				s_here += times;
			}
		already += '0' + bit;
		rec(w2, s_here, already);
		already.pop_back();
	}
}

int main() {
	scanf("%d%d", &n, &k);
	++n;
	vector<int> w(1 << (n + 1));
	//~ vector<pair<int,int>> w;
	int S = 0;
	for(int len = 0; len < n; ++len) {
		scanf("%s", sl);
		assert((int) strlen(sl) == (1 << len));
		for(int i = 0; i < (1 << len); ++i) if(sl[i] == '1') {
			++w[(1<<len)+i];
			++S;
		}
			//~ w.push_back({len, i});
	}
	debug() << imie(w.size());
	rec(w, S, "");
	cout << best << endl;
}