atcoder#ARC058D. [ARC058F] 文字列大好きいろはちゃん

[ARC058F] 文字列大好きいろはちゃん

Score : 15001500 points

Problem Statement

Iroha has a sequence of NN strings s1,s2,...,sNs_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 KK that she can produce in this way, find the lexicographically smallest one.

Constraints

  • 1N20001 \leq N \leq 2000
  • 1K1041 \leq K \leq 10^4
  • For each ii, 1siK1 \leq |s_i| \leq K.
  • s1+s2+...+sN106|s_1| + |s_2| + ... + |s_N| \leq 10^6
  • For each ii, sis_i consists of lowercase letters.
  • There exists at least one string of length KK that Iroha can produce.

Input

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

NN KK

s1s_1

s2s_2

:

sNs_N

Output

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

3 7
at
coder
codar
atcodar

at and codar should be chosen.

3 7
coder
codar
at
codarat

codar and at should be chosen.

4 13
kyuri
namida
zzzzzzz
aaaaaa
namidazzzzzzz

namida and zzzzzzz should be chosen.