#include <bits/stdc++.h>
template <typename Tp>
void read(Tp &res) {
  static char ch;
  ch = getchar(), res = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) res = res * 10 + ch - 48, ch = getchar();
}
void read(char *s) {
  static char ch;
  ch = getchar();
  while (!isgraph(ch)) ch = getchar();
  while (isgraph(ch)) *(s++) = ch, ch = getchar();
  *s = '\0';
}
template <typename Tp>
void chkmax(Tp &a, const Tp &b) {
  if (b > a) a = b;
}
const int MAXN = 2e2 + 19, MAXS = 2e2 + 1;
int n, son[MAXS][26], fail[MAXS], val[MAXS], a[MAXN], ind;
long long l;
char s[MAXS];
struct Matrix {
  long long a[MAXS][MAXS];
  Matrix operator*(const Matrix &b) const {
    Matrix res;
    memset(res.a, -0x3f, sizeof res.a);
    for (int i = 0; i <= ind; ++i)
      for (int j = 0; j <= ind; ++j)
        for (int k = 0; k <= ind; ++k) chkmax(res.a[i][j], a[i][k] + b.a[k][j]);
    return res;
  }
} ret;
Matrix qpow(Matrix a, long long b) {
  Matrix res;
  memset(res.a, -0x3f, sizeof res.a);
  for (int i = 0; i <= ind; ++i) res.a[i][i] = 0;
  while (b) {
    if (b & 1) res = res * a;
    a = a * a, b >>= 1;
  }
  return res;
}
void insert(int p, char *s, int len) {
  int node = 0;
  for (int i = 0; i < len; ++i) {
    if (!son[node][s[i] - 'a']) son[node][s[i] - 'a'] = ++ind;
    node = son[node][s[i] - 'a'];
  }
  val[node] += a[p];
}
void build(void) {
  std::queue<int> q;
  for (int i = 0; i < 26; ++i)
    if (son[0][i]) q.push(son[0][i]);
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    for (int i = 0; i < 26; ++i)
      if (son[node][i])
        fail[son[node][i]] = son[fail[node]][i], q.push(son[node][i]);
      else
        son[node][i] = son[fail[node]][i];
    val[node] += val[fail[node]];
  }
}
int main() {
  read(n), read(l);
  for (int i = 1; i <= n; ++i) read(a[i]);
  for (int i = 1, len; i <= n; ++i) {
    read(s), len = strlen(s);
    insert(i, s, len);
  }
  build();
  for (int i = 0; i <= ind; ++i)
    for (int j = 0; j <= ind; ++j) ret.a[i][j] = -1e9;
  for (int i = 0; i <= ind; ++i)
    for (int j = 0; j < 26; ++j)
      chkmax(ret.a[i][son[i][j]], (long long)val[son[i][j]]);
  ret = qpow(ret, l);
  long long ans = 0ll;
  for (int i = 0; i <= ind; ++i) chkmax(ans, ret.a[0][i]);
  printf("%lld\n", ans);
  return 0;
}
