#include <bits/stdc++.h>
using namespace std;
struct yts {
  long long dp[210][210];
} a, ans, t;
int ch[210][26], fail[210], q[210], root = 1;
long long w[210], b[210];
int n, m, tot = 1;
char s[210];
long long L;
void insert(int id) {
  int x = root, len = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    int t = s[i] - 'a';
    if (!ch[x][t]) ch[x][t] = ++tot;
    x = ch[x][t];
  }
  w[x] += b[id];
}
void build_fail() {
  int l = 0, r = 0;
  for (int i = 0; i < 26; i++)
    if (ch[root][i])
      fail[ch[root][i]] = root, q[++r] = ch[root][i];
    else
      ch[root][i] = root;
  while (l < r) {
    int x = q[++l];
    w[x] += w[fail[x]];
    for (int i = 0; i < 26; i++)
      if (ch[x][i])
        fail[ch[x][i]] = ch[fail[x]][i], q[++r] = ch[x][i];
      else
        ch[x][i] = ch[fail[x]][i];
  }
}
void mul(yts &c, yts &a, yts &b) {
  memset(t.dp, -1, sizeof(t.dp));
  for (int k = 1; k <= tot; k++)
    for (int i = 1; i <= tot; i++)
      for (int j = 1; j <= tot; j++)
        if (a.dp[i][k] != -1 && b.dp[k][j] != -1)
          t.dp[i][j] = max(t.dp[i][j], a.dp[i][k] + b.dp[k][j]);
  for (int i = 1; i <= tot; i++)
    for (int j = 1; j <= tot; j++) c.dp[i][j] = t.dp[i][j];
}
void power() {
  memset(ans.dp, -1, sizeof(ans.dp));
  for (int i = 1; i <= tot; i++) ans.dp[i][i] = 0;
  while (L) {
    if (L & 1) mul(ans, ans, a);
    mul(a, a, a);
    L >>= 1;
  }
}
void build_a() {
  memset(a.dp, -1, sizeof(a.dp));
  for (int i = 1; i <= tot; i++)
    for (int c = 0; c < 26; c++) {
      if (a.dp[i][ch[i][c]] == -1) a.dp[i][ch[i][c]] = 0;
      a.dp[i][ch[i][c]] += w[ch[i][c]];
    }
}
int main() {
  scanf("%d%I64d", &n, &L);
  for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    insert(i);
  }
  build_fail();
  build_a();
  power();
  long long ANS = 0;
  for (int i = 1; i <= tot; i++)
    if (ans.dp[root][i] != -1) ANS = max(ANS, ans.dp[root][i]);
  printf("%I64d\n", ANS);
  return 0;
}
