Problem:
Score : 1500 points

Problem Statement

Iroha has a sequence of N strings s_1, s_2, ..., s_N.

She will choose some (possibly all) strings from the sequence, then concatenate those strings retaining the relative order, to produce a long string.

Among all strings of length K that she can produce in this way, find the lexicographically smallest one.

Constraints

1 ≦ N ≦ 2000

1 ≦ K ≦ 10^4

For each i, 1 ≦ |s_i| ≦ K.

|s_1| + |s_2| + ... + |s_N| ≦ 10^6

For each i, s_i consists of lowercase letters.

There exists at least one string of length K that Iroha can produce.

Input

The input is given from Standard Input in the following format:

N K
s_1
s_2
:
s_N

Output

Print the lexicographically smallest string of length K that Iroha can produce.

Sample Input 1

3 7
at
coder
codar

Sample Output 1

atcodar

at and codar should be chosen.

Sample Input 2

3 7
coder
codar
at

Sample Output 2

codarat

codar and at should be chosen.

Sample Input 3

4 13
kyuri
namida
zzzzzzz
aaaaaa

Sample Output 3

namidazzzzzzz

namida and zzzzzzz should be chosen.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define MP make_pair
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;

const double PI = acos(-1);
const double EPS = 1e-9;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

///////////////////////////////////////////////////////

const int N = 2000;
const int N2 = 1e4;

struct datt{
	string str;
	int id;
}dat[N + 5];

int n;
int len;
bool flag[N + 5][N2 + 5];
int nxt[N + 5][N2 + 5];
string name[N + 5];

bool cmp(datt a, datt b){
	if(a.str != b.str) return a.str < b.str;
	return a.id < b.id;
}

void getFlag(){
	memset(nxt,-1,sizeof nxt);
	FOR(i,n+1) flag[i][0] = true;
	FORD(i,n){
		FOR(lg,len+1){
			if(flag[i+1][lg]){
				flag[i][min(N2+1, lg+(int)(dat[i].str).length())] = true;
				if(lg > 0) nxt[i][min(N2+1, lg+(int)(dat[i].str).length())] = i+1;
				else nxt[i][min(N2+1, lg+(int)(dat[i].str).length())] = i;
			}
		}
	}
}

void bt(int id, int rem){
	if(id == -1) return;
	cout << name[id];
	if(nxt[id][rem] != id) bt(nxt[id][rem], rem - (int)name[id].length());
}

void solve(){
	FOR(i,n){
		if(flag[dat[i].id][len]){
			bt(dat[i].id,len);
			break;
		}
	}
}

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> len;
	FOR(i,n){
		cin >> dat[i].str;
		name[i] = dat[i].str;
		dat[i].id = i;
	}
	getFlag();
//	FOR(i,n){
//		FOR(j,len+1) printf("%d ",nxt[i][j]);
//		puts("");
//	}
	sort(dat,dat+n,cmp);
//	FOR(i,n) cout << dat[i].str << endl;
	solve();
	return 0;
}