#include <bits/stdc++.h>
using namespace std;
struct mat {
  long long a[205][205];
} now;
struct note {
  int to[28], fail, val;
} t[205];
int a[205];
int n, num, rt;
long long L;
int que[205];
mat operator*(mat x, mat y) {
  mat ret;
  memset(ret.a, 255, sizeof(ret.a));
  for (int i = 0; i <= 200; i++)
    for (int j = 0; j <= 200; j++)
      for (int k = 0; k <= 200; k++)
        if (x.a[i][k] >= 0 && y.a[k][j] >= 0) {
          ret.a[i][j] = (((ret.a[i][j]) > (x.a[i][k] + y.a[k][j]))
                             ? ret.a[i][j]
                             : x.a[i][k] + y.a[k][j]);
        }
  return ret;
}
void getfail() {
  int l = 1, r = 1;
  que[l] = rt;
  while (l <= r) {
    int now = que[l];
    if (t[now].fail != now) t[now].val += t[t[now].fail].val;
    for (int i = 1; i <= 26; i++) {
      if (t[now].to[i]) {
        que[++r] = t[now].to[i];
        if (now) t[t[now].to[i]].fail = t[t[now].fail].to[i];
      } else {
        t[now].to[i] = t[t[now].fail].to[i];
      }
    }
    l++;
  }
}
mat mul(mat x, long long y) {
  mat ret;
  memset(ret.a, 255, sizeof(ret.a));
  for (int i = 0; i <= num; i++) ret.a[i][0] = 0;
  while (y) {
    if (y % 2 == 1) ret = ret * x;
    x = x * x;
    y /= 2;
  }
  return ret;
}
int main() {
  scanf("%d%I64d", &n, &L);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    char s[205];
    memset(s, 0, sizeof(s));
    cin >> s;
    int len = strlen(s);
    int now = rt;
    for (int j = 0; j <= len - 1; j++) {
      if (!t[now].to[s[j] - 'a' + 1]) t[now].to[s[j] - 'a' + 1] = ++num;
      now = t[now].to[s[j] - 'a' + 1];
    }
    t[now].val += a[i];
  }
  getfail();
  memset(now.a, 255, sizeof(now.a));
  for (int i = 0; i <= num; i++)
    for (int j = 1; j <= 26; j++) {
      now.a[i][t[i].to[j]] = t[t[i].to[j]].val;
    }
  mat ans = mul(now, L);
  long long pri = 0;
  for (int i = 0; i <= num; i++)
    pri = (((pri) > (ans.a[0][i])) ? pri : ans.a[0][i]);
  printf("%I64d", pri);
  return 0;
}
