#include <bits/stdc++.h>
using namespace std;
void rf() {}
const int nx[8] = {2, -2, -2, 2, 1, 1, -1, -1};
const int ny[8] = {1, 1, -1, -1, 2, -2, -2, 2};
const int Nx[4] = {0, 0, -1, 1};
const int Ny[4] = {1, -1, 0, 0};
const long long LINF = (long long)1e18;
const int INF = 1e9 + 7;
const int MAGIC = 1e6 + 1;
const int N = 2e2 + 20;
const int MAXN = 1e6 + 50;
const double EPS = 1e-9, PI = 3.14159265359;
int n;
long long l;
int a[N];
struct trie {
  int go[26];
  int cost, suff_link, p, ch;
  trie() {
    memset(go, -1, sizeof(go));
    cost = p = ch = 0;
    suff_link = -1;
  }
};
trie t[MAXN];
int sz;
void add(string second, int delta) {
  int cur = 0;
  for (auto it : second) {
    int accepted = it - 'a';
    if (t[cur].go[accepted] == -1) t[cur].go[accepted] = ++sz;
    int pr = cur;
    cur = t[cur].go[accepted];
    t[cur].ch = accepted;
    t[cur].p = pr;
  }
  t[cur].cost += delta;
}
int go(int x, int y);
int get_suff(int x) {
  if (x == 0 || t[x].p == 0) t[x].suff_link = 0;
  if (t[x].suff_link != -1) return t[x].suff_link;
  return t[x].suff_link = go(get_suff(t[x].p), t[x].ch);
}
int go(int x, int y) {
  if (t[x].go[y] != -1) return t[x].go[y];
  return t[x].go[y] = (x == 0 ? 0 : go(get_suff(x), y));
}
bool used[N];
int dfs(int x) {
  if (used[x] || x == 0) return t[x].cost;
  used[x] = 1;
  t[x].cost += dfs(t[x].suff_link);
  return t[x].cost;
}
struct matrix {
  long long a[N][N];
  matrix() {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        a[i][j] = -LINF;
      }
    }
  }
};
matrix dp, res;
const matrix operator*(matrix A, matrix B) {
  matrix res;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < N; k++) {
        res.a[i][j] = max(res.a[i][j], A.a[i][k] + B.a[k][j]);
      }
    }
  }
  return res;
}
int main() {
  srand(time(0));
  rf();
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    string second;
    cin >> second;
    add(second, a[i]);
  }
  for (int i = 0; i <= sz; i++) {
    for (int j = 0; j < 26; j++) go(i, j);
    t[i].suff_link = get_suff(i);
  }
  for (int i = 0; i <= sz; i++) t[i].cost = dfs(i);
  for (int i = 0; i <= sz; i++)
    for (int j = 0; j < 26; j++) dp.a[i][t[i].go[j]] = t[t[i].go[j]].cost;
  for (int j = 0; j < 26; j++) res.a[0][t[0].go[j]] = t[t[0].go[j]].cost;
  l--;
  while (l) {
    if (l & 1) res = res * dp;
    dp = dp * dp;
    l /= 2;
  }
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      ans = max(ans, res.a[i][j]);
    }
  }
  cout << ans;
  return 0;
}
