import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto S = N.iota.map!(_ => readln.chomp).array;
    auto L = S.map!(s => s.length.to!int).array;

    auto ok = new bool[][](N+1, K+1);
    ok[N][K] = true;

    foreach_reverse (i; 0..N) {
        foreach (j; 0..K+1-L[i]) {
            if (ok[i+1][j+L[i]]) {
                ok[i][j] = true;
            }
        }
        ok[i][K] = true;
    }


    auto rank = new int[](N);
    auto T = N.iota.map!(i => tuple(S[i], i)).array;
    T.sort();
    foreach (i; 0..N) rank[T[i][1]] = i;

    string ans = "";

    for (int i = 0, j = 0; j < K; ) {
        int best_rank = 1 << 29;
        int best_index = -1;
        for (int k = i; k < N; ++k) {
            if (ok[k][j] && rank[k] < best_rank) {
                best_rank = rank[k];
                best_index = k;
            }
        }
        ans ~= S[best_index];
        i = best_index + 1;
        j += L[best_index];
    }

    ans.writeln;
}
