#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, const U &b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, const U &b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T1, class T2>
inline void gn(T1 &x1, T2 &x2) {
  gn(x1), gn(x2);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
struct AC_Automata {
  int go[222][26], fail[222], val[222];
  int nMem;
  int new_Node() {
    ++nMem;
    fail[nMem] = val[nMem] = 0;
    for (int i = 0; i < 26; i++) go[nMem][i] = 0;
    return nMem;
  }
  void init() {
    nMem = 0;
    for (int i = 0; i < 26; i++) go[0][i] = 1;
    new_Node();
  }
  void add(char *str, int v) {
    int cur = 1;
    for (int i = 0; str[i]; i++) {
      int c = str[i] - 'a';
      if (!go[cur][c]) go[cur][c] = new_Node();
      cur = go[cur][c];
    }
    val[cur] += v;
  }
  void make_fail() {
    queue<int> que;
    que.push(1);
    while (!que.empty()) {
      int fr = que.front();
      que.pop();
      for (int i = 0; i < 26; i++) {
        if (go[fr][i]) {
          int ptr = fail[fr];
          while (ptr && !go[ptr][i]) ptr = fail[ptr];
          fail[go[fr][i]] = go[ptr][i];
          val[go[fr][i]] += val[fail[go[fr][i]]];
          que.push(go[fr][i]);
        }
      }
    }
  }
  int find_next(int p, int c) {
    while (!go[p][c]) p = fail[p];
    return go[p][c];
  }
} AC;
int a[222];
char s[222];
long long mat[222][222], tmp[222][222];
long long ans[222], tp[222];
void multi(long long a[222][222], long long b[222][222], long long c[222][222],
           int n) {
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      tmp[i][j] = -(1LL << 60);
      for (int k = 1; k <= n; k++) smax(tmp[i][j], a[i][k] + b[k][j]);
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) c[i][j] = tmp[i][j];
}
int main() {
  int n;
  long long l;
  cin >> n >> l;
  AC.init();
  for (int i = 0; i < n; i++) gn(a[i]);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    AC.add(s, a[i]);
  }
  AC.make_fail();
  n = AC.nMem;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) mat[i][j] = -(1LL << 60);
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 26; j++) {
      int k = AC.find_next(i, j);
      smax(mat[i][k], AC.val[k]);
    }
  for (int i = 2; i <= n; i++) ans[i] = -(1LL << 60);
  while (l) {
    if (l & 1) {
      for (int i = 1; i <= n; i++) tp[i] = ans[i];
      for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++) smax(ans[j], tp[i] + mat[i][j]);
    }
    multi(mat, mat, mat, n);
    l >>= 1;
  }
  cout << *max_element(ans + 1, ans + n + 1) << endl;
  return 0;
}
