#include <bits/stdc++.h>
using namespace std;
int L;
struct Mat {
  long long a[210][210];
  explicit Mat() {
    memset(a, 0x80, sizeof(a));
    for (int i = 0, ed_i = L; i < ed_i; i++) {
      a[i][i] = 0;
    }
  }
  long long *operator[](int x) { return a[x]; }
  Mat operator*(const Mat &rhs) {
    Mat ret;
    for (int i = 0, ed_i = L; i < ed_i; i++) {
      for (int j = 0, ed_j = L; j < ed_j; j++) {
        for (int k = 0, ed_k = L; k < ed_k; k++) {
          ret[i][j] = max(ret[i][j], a[i][k] >= 0 && rhs.a[k][j] >= 0
                                         ? a[i][k] + rhs.a[k][j]
                                         : -(1ll << 60));
        }
      }
    }
    return ret;
  }
  Mat(const Mat &rhs) { memcpy(a, rhs.a, sizeof(a)); }
  Mat &operator=(const Mat &rhs) {
    memcpy(a, rhs.a, sizeof(a));
    return *this;
  }
  void print() {
    for (int i = 0, ed_i = L; i < ed_i; i++) {
      for (int j = 0, ed_j = L; j < ed_j; j++) {
        printf("%I64d%s", a[i][j], j == L - 1 ? "\n" : " ");
      }
    }
  }
};
Mat fPow(Mat t, long long p) {
  Mat ret;
  while (p) {
    if (p & 1) ret = ret * t;
    t = t * t;
    p >>= 1;
  }
  return ret;
}
namespace AC {
int sz, ch[210][26], val[210];
void insert(char *str, int v) {
  int u = 0, len = 0;
  while (*str) {
    int c = (*str++) - 'a';
    len++;
    if (!ch[u][c]) {
      ch[u][c] = ++sz;
      memset(ch[sz], 0, sizeof(ch[sz]));
      val[sz] = 0;
    }
    u = ch[u][c];
  }
  val[u] += v;
}
int fr, rr, que[210], fa[210], lst[210];
void calc_fa() {
  fr = 0, rr = -1;
  for (int i = 0, ed_i = 26; i < ed_i; i++) {
    if (ch[0][i]) {
      que[++rr] = ch[0][i];
      fa[ch[0][i]] = 0;
      lst[ch[0][i]] = 0;
    }
  }
  while (fr <= rr) {
    int r = que[fr++];
    for (int i = 0, ed_i = 26; i < ed_i; i++) {
      int u = ch[r][i];
      if (!u) {
        ch[r][i] = ch[fa[r]][i];
        continue;
      }
      fa[u] = ch[fa[r]][i];
      lst[u] = val[fa[u]] ? fa[u] : lst[fa[u]];
      val[u] += val[lst[u]];
      que[++rr] = u;
    }
  }
}
}  // namespace AC
using namespace AC;
int a[210];
char s[210];
int main() {
  int n;
  long long len;
  scanf("%d%I64d", &n, &len);
  for (int i = 1, ed_i = n; i <= ed_i; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1, ed_i = n; i <= ed_i; i++) {
    scanf("%s", s);
    insert(s, a[i]);
  }
  calc_fa();
  L = sz + 1;
  Mat mat0;
  for (int i = 0, ed_i = L; i < ed_i; i++) {
    for (int j = 0, ed_j = 26; j < ed_j; j++) {
      mat0[i][ch[i][j]] = val[ch[i][j]];
    }
  }
  Mat mat1 = fPow(mat0, len);
  long long ans = 0;
  for (int i = 0, ed_i = L; i < ed_i; i++) {
    ans = max(ans, mat1[0][i]);
  }
  printf("%I64d\n", ans);
  return 0;
}
