Problem: 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.

Examples

Input

3 7
at
coder
codar


Output

atcodar


Input

3 7
coder
codar
at


Output

codarat


Input

4 13
kyuri
namida
zzzzzzz
aaaaaa


Output

namidazzzzzzz

Solution (in CPP):

Solution:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <bitset>
using namespace std;
const int MAXN = 2005;
int n,k;
bitset<10005>legal[MAXN];
char s[MAXN][10005];
char opt[10005],t[20005];
int anslen;
int ext[20005],len[2005],tlen;
struct Node{
	int x,y;
};
inline int cmp(Node a,Node b)
{
	if(!a.y && !b.y)return 0;
	int p=a.x+a.y;
	if(!a.y || !b.y){
		if(a.x>=b.x)return 0;
		if(b.y)return -cmp(b,a);
		int len=ext[p];
		if(a.x+len>=b.x)return 0;		
		else return t[ext[p]]<t[p+ext[p]] ? 1 : -1;
	}
	if(a.x==b.x)return 0;
	if(a.x>b.x)return -cmp(b,a);
	int len=ext[p];
	if(a.x+len<b.x)return t[ext[p]]<t[p+ext[p]] ? 1 : -1;
	p=b.x-a.x;
	len=ext[p];
	if(b.x+len>=a.x+a.y)return 0;
	return t[ext[p]]<t[p+ext[p]] ? -1 : 1;
}
bool operator < (const Node &a,const Node &b)
{
	return cmp(a,b)>0;
}
bool operator == (const Node &a,const Node &b)
{
	return cmp(a,b)==0;
}
inline void exkmp()
{
	ext[0]=tlen;
//	cout<<tlen<<endl;
	int k=0,p;
	while(k+1<tlen&& t[k+1]==t[k])++k;
	ext[1]=k;
	p=1;
	for(int i=2;i<tlen;++i){
		int len=ext[i-p];
		if(i+len<p+ext[p])ext[i]=len;
		else {
			int j=p+ext[p]-i;
			j=max(0,j);
			while(i+j<tlen && t[i+j]==t[j])++j;
			ext[i]=j;
			p=i;
		}
	}
}
Node stk[100005];
bool ok[100005];
int top;
int main()
{	
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)scanf("%s",s[i]),len[i]=strlen(s[i]);
	legal[n+1][0]=1;
	for(int i=n;i;--i){
		legal[i]|=(legal[i+1]<<len[i]);
		legal[i]|=legal[i+1];
	}
	ok[0]=true;
	anslen=0;
	for(int i=1;i<=n;++i){
/*		cout<<"Now  "<<i<<endl;
		cout<<len[i]<<" "<<anslen<<endl; */
//		cout<<"Nowbest:   ";
//		for(int j=0;j<anslen;++j)cout<<opt[j];
//		cout<<endl;
		for(int j=0;j<len[i];++j)t[j]=s[i][j];
		for(int j=0;j<anslen;++j)t[j+len[i]]=opt[j];
		t[anslen+len[i]]='\0';		
		tlen=anslen+len[i];
//		cout<<tlen<<endl;
		exkmp();
//		cout<<"entered"<<endl;
//		cout<<opt<<endl;
//		for(int i=0;i<=opt.size();++i)
//			cout<<is[i];
//		cout<<endl;
		top=0;
		for(int j=0;j<=anslen && j<=k;++j){
			if(ok[j] && legal[i+1][k-j]){
				Node now=(Node){j,0};
				while(top>0 && now<stk[top])--top;
				if(!top || now==stk[top])stk[++top]=now;
			}
//				int sta=cmp(i,j+len[i]);				
//				cout<<sta<<" ";
				
/*				if(sta==1 || j==anslen){
					if(sta==1){		
						for(int k=j+1;k<=anslen;++k)is[k]=0;
						for(int k=j;k<j+len[i];++k)opt[k]=s[i][k-j];
						anslen=j+len[i];
						is[anslen]=1;
						flag=true;					
					}else{
						lastpos=j;
						is[j+len[i]]=1;
					}
					break;
				}else if(sta==-2){
					is[j+len[i]]=true;
				}else if(sta==-1){
					lastpos=j;
					is[j+len[i]]=1;
				}
*/
			
		}
		for(int j=0;j<=anslen && j+len[i]<=k;++j){
			if(ok[j] && legal[i+1][k-j-len[i]]){						
				Node now=(Node){j,len[i]};
				while(top>0 && now<stk[top])--top;
				if(!top || now==stk[top])stk[++top]=now;

			}
		}
//		cout<<endl;
		if(!top)continue;	   
		if(stk[top].y){
			for(int j=0;j<stk[top].y;++j)opt[stk[top].x+j]=s[i][j];
		}		
		for(int i=0;i<=anslen;++i)ok[i]=0;
		anslen=stk[top].x+stk[top].y;
		for(int i=1;i<=top;++i)
			ok[stk[i].x+stk[i].y]=true;
	}	
	for(int i=0;i<anslen;++i)
		printf("%c",opt[i]);
	puts("");
	return 0;
}