#include <bits/stdc++.h>
using namespace std;
const int maxn = 210;
int son[maxn][26], fail[maxn], tot;
int n, a[maxn];
long long limit, ans, val[maxn];
void add(int w) {
  string st;
  cin >> st;
  int len = st.size();
  int first = 0;
  for (int i = (0); i <= (len - 1); ++i) {
    if (son[first][st[i] - 'a'] == 0) son[first][st[i] - 'a'] = ++tot;
    first = son[first][st[i] - 'a'];
  }
  val[first] += 1LL * w;
}
void build() {
  queue<int> D;
  while (!D.empty()) D.pop();
  for (int i = (0); i <= (25); ++i)
    if (son[0][i]) D.push(son[0][i]);
  while (!D.empty()) {
    int first = D.front();
    D.pop();
    for (int i = (0); i <= (25); ++i)
      if (son[first][i]) {
        fail[son[first][i]] = son[fail[first]][i];
        val[son[first][i]] += val[fail[son[first][i]]];
        D.push(son[first][i]);
      } else
        son[first][i] = son[fail[first]][i];
  }
}
void init() {
  cin >> n >> limit;
  for (int i = (1); i <= (n); ++i) cin >> a[i];
  for (int i = (1); i <= (n); ++i) add(a[i]);
  build();
}
struct Map {
  long long cost[maxn][maxn];
  Map() {
    for (int i = (0); i <= (tot); ++i)
      for (int j = (0); j <= (tot); ++j) cost[i][j] = -1LL << 60;
  }
  Map operator+(const Map b) {
    Map t = Map();
    for (int k = (0); k <= (tot); ++k)
      for (int i = (0); i <= (tot); ++i)
        for (int j = (0); j <= (tot); ++j)
          t.cost[i][j] = max(t.cost[i][j], cost[i][k] + b.cost[k][j]);
    return t;
  }
} f, g;
void solve() {
  g = Map();
  for (int i = (0); i <= (tot); ++i)
    for (int j = (0); j <= (25); ++j) g.cost[i][son[i][j]] = val[son[i][j]];
  int t = 0;
  for (int i = (0); i <= (60); ++i) {
    if ((limit >> i) & 1) {
      if (!t)
        f = g, t = 1;
      else
        f = f + g;
    }
    g = g + g;
  }
  for (int i = (1); i <= (tot); ++i) ans = max(ans, f.cost[0][i]);
  cout << ans << endl;
}
int main() {
  init();
  solve();
  return 0;
}
