#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  bool f = 1;
  char c = getchar();
  while (c > 57 || c < 48) {
    if (c == '-') f = 0;
    c = getchar();
  }
  while (c >= 48 && c <= 57) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f ? x : -x;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9)
    write(x / 10), putchar(x % 10 + 48);
  else
    putchar(x + 48);
}
long long n, l, a[210], len;
char s[210];
long long fail[210], ch[210][26], v[210], cnt;
struct mat {
  long long n, m, a[210][210];
  mat() {
    n = m = 0;
    a[0][0] = -1e13;
  }
};
inline mat operator*(mat a, mat b) {
  if (a.m != b.n) return mat();
  mat c;
  c.n = a.n;
  c.m = b.m;
  for (long long i = 0; i <= a.n; i++) {
    for (long long j = 0; j <= b.m; j++) {
      c.a[i][j] = -1e13;
      for (long long k = 0; k <= a.m; k++) {
        c.a[i][j] = max(c.a[i][j], a.a[i][k] + b.a[k][j]);
      }
    }
  }
  return c;
}
inline mat one() {
  mat a;
  a.n = a.m = cnt;
  for (long long i = 0; i <= cnt; i++)
    for (long long j = 0; j <= cnt; j++) a.a[i][j] = (i == j ? 0 : -1e13);
  return a;
}
inline mat dp() {
  mat a;
  a.n = 0;
  a.m = cnt;
  a.a[0][0] = 0;
  for (long long i = 1; i <= cnt; i++) a.a[0][i] = -1e13;
  return a;
}
inline mat change() {
  mat a;
  a.n = a.m = cnt;
  for (long long i = 0; i <= cnt; i++)
    for (long long j = 0; j <= cnt; j++) a.a[i][j] = -1e13;
  for (long long i = 0; i <= cnt; i++) {
    for (long long j = 0; j < 26; j++) a.a[i][ch[i][j]] = v[ch[i][j]];
  }
  return a;
}
inline mat fastPow(mat a, long long b) {
  mat ret = one(), base = a;
  for (long long i = 1; i <= b; i <<= 1) {
    if (i & b) ret = ret * base;
    base = base * base;
  }
  return ret;
}
inline void ins(char *s, const long long len, const long long val) {
  long long now = 0, c;
  for (long long i = 1; i <= len; i++) {
    c = s[i] - 'a';
    if (!ch[now][c]) ch[now][c] = ++cnt;
    now = ch[now][c];
  }
  v[now] += val;
}
inline void build() {
  queue<long long> q;
  for (long long i = 0; i < 26; i++)
    if (ch[0][i]) q.push(ch[0][i]);
  while (!q.empty()) {
    const long long x = q.front();
    q.pop();
    v[x] += v[fail[x]];
    for (long long i = 0; i < 26; i++) {
      if (ch[x][i]) {
        fail[ch[x][i]] = ch[fail[x]][i];
        q.push(ch[x][i]);
      } else
        ch[x][i] = ch[fail[x]][i];
    }
  }
}
signed main() {
  n = read();
  l = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    len = strlen(s + 1);
    ins(s, len, a[i]);
  }
  build();
  mat ans = dp() * fastPow(change(), l);
  long long ret = -1e13;
  for (long long i = 0; i <= cnt; i++) ret = max(ret, ans.a[0][i]);
  write(ret);
  return 0;
}
