#include<string>
#include<vector>
std::vector<int> z_algorithm(const std::string& S) {
  std::vector<int> Z(S.size(), S.size());
  for(int i = 1, L = 0, R = 0; i < S.size(); ++i) {
    if(i > R) {
      L = R = i;
      while(R < S.size() && S[R - L] == S[R]) ++R;
      Z[i] = R-- - L;
    } else {
      if(Z[i - L] < R - i + 1) Z[i] = Z[i - L];
      else {
        L = i;
        while(R < S.size() && S[R - L] == S[R]) ++R;
        Z[i] = R-- - L;
      }
    }
  }
  return Z;
}

#include<bits/stdc++.h>
using namespace std;

int cmp(const auto& S, const auto& CS, const auto& Z, int best, int j) {
  if(CS.empty()) return 1;
  if(best == -1) {
    // CS <=> CS[0...j] + S
    if(CS.size() <= j) return 0;      // CS ⊂ CS[0...j] + S
    auto z = Z[S.size() + j];
    if(z >= S.size()) return 0;       // CS ⊇ CS[0...j] + S
    if(j + z >= CS.size()) return 0;  // CS ⊆ CS[0...j] + S
    if(CS[j + z] > S[z]) return 1;
    return -1;
  } else {
    // CS[0...best] + S <=> CS[0...j] + S
    if(best > j) return -cmp(S, CS, Z, j, best);
    if(best == j) return 0;                     // CS[0...best] + S = CS[0...j] + S
    // CS[0...best] + S <=> CS[0...j-1]
    auto z = Z[S.size() + best];
    if(best + z < j) {
      if(S[z] > CS[best + z]) return 1;
      return -1;
    }
    // S[d...] <=> S
    auto d = j - best;
    z = Z[d];
    if(d + z >= S.size()) return 0;             // CS[0...best] + S ⊂ CS[0...j] + S
    if(S[d + z] > S[z]) return 1;
    return -1;
  }
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<string> S(N);
  for(auto& i: S) cin >> i;

  vector<vector<bool>> reach(N + 1, vector<bool>(K + 1));
  reach[N][0] = true;
  for(int i = N - 1; 0 <= i; --i) {
    reach[i] = reach[i + 1];
    for(int j = K; S[i].size() <= j; --j) reach[i][j] = reach[i][j] | reach[i][j - S[i].size()];
  }

  vector<string> CS(N + 1);
  vector<vector<bool>> dp(N + 1, vector<bool>(K + 1));
  dp[0][0] = true;
  for(int i = 0; i < N; ++i) {
//     cout<<"CS: "<<CS[i]<<endl;
//     cout<<"dp:";for(auto k:dp[i])cout<<" "<<k;cout<<endl;
//     cout<<"nx:";for(auto k:reach[i+1])cout<<" "<<k;cout<<endl;
    auto Z = z_algorithm(S[i] + CS[i]);
    int best = -1;
    CS[i + 1] = CS[i];
    for(int j = 0; j <= K - S[i].size(); ++j) {
      if(!dp[i][j]) continue;
      if(!reach[i + 1][K - j - S[i].size()]) continue;
      auto c = cmp(S[i], CS[i], Z, best, j);
      if(c < 0) continue;
      if(c == 0 && j + S[i].size() <= CS[i + 1].size()) continue;
      best = j;
      CS[i + 1] = CS[i].substr(0, best) + S[i];
    }
//     cout<<best<<endl;
    int dif = 0;
    while(dif < CS[i].size() && dif < CS[i + 1].size() && CS[i][dif] == CS[i + 1][dif]) ++dif;
    if(dif == CS[i + 1].size()) dif = CS[i].size();
    for(int j = 0; j <= CS[i].size(); ++j) {
      if(!dp[i][j]) continue;
      if(best == -1) {
        if(reach[i + 1][K - j]) dp[i + 1][j] = true;
        if(K < j + S[i].size()) continue;
        if(!reach[i + 1][K - j - S[i].size()]) continue;
        if(cmp(S[i], CS[i], Z, best, j) < 0) continue;
        dp[i + 1][j + S[i].size()] = true;
      } else {
        if(j <= dif) if(reach[i + 1][K - j]) dp[i + 1][j] = true;
        if(K < j + S[i].size()) continue;
        if(!reach[i + 1][K - j - S[i].size()]) continue;
        if(cmp(S[i], CS[i], Z, best, j) < 0) continue;
        dp[i + 1][j + S[i].size()] = true;
      }
    }
  }

  cout << CS[N] << endl;
}


Measured memory_bytes: 26240