#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 205, M = 0, Z = 1e9 + 7, ms63 = 0x3f3f3f3f;
const int G = 202;
struct MX {
  long long v[G][G];
  void O() { memset(v, -63, sizeof(v)); }
  void E() {
    memset(v, -63, sizeof(v));
    for (int i = 0; i < G; ++i) v[i][i] = 0;
  }
  MX operator*(const MX &b) const {
    MX c;
    c.O();
    for (int i = 0; i < G; i++) {
      for (int j = 0; j < G; j++) {
        for (int k = 0; k < G; k++) {
          gmax(c.v[i][j], v[i][k] + b.v[k][j]);
        }
      }
    }
    return c;
  }
  MX operator^(long long p) const {
    MX y;
    y.E();
    MX x;
    memcpy(x.v, v, sizeof(x.v));
    while (p) {
      if (p & 1) y = y * x;
      x = x * x;
      p >>= 1;
    }
    return y;
  }
} a, b, c;
int id;
char s[N];
int fail[N];
int nxt[N][26];
int cnt[N];
void insert(char s[], int val) {
  int p = 1;
  for (int i = 0; s[i]; i++) {
    int x = s[i] - 'a';
    if (nxt[p][x] == 0) nxt[p][x] = ++id;
    p = nxt[p][x];
  }
  cnt[p] += val;
}
int getfail(int p, int x) {
  while (p) {
    if (nxt[p][x]) return nxt[p][x];
    p = fail[p];
  }
  return 1;
}
void AC_automation() {
  queue<int> q;
  q.push(1);
  int pap, son;
  while (!q.empty()) {
    pap = q.front();
    q.pop();
    for (int i = 0; i < 26; ++i)
      if (nxt[pap][i]) {
        son = nxt[pap][i];
        fail[son] = getfail(fail[pap], i);
        q.push(son);
        cnt[son] += cnt[fail[son]];
        b.v[pap][son] = cnt[son];
      } else {
        int fl = getfail(fail[pap], i);
        if (fl)
          b.v[pap][fl] = cnt[fl];
        else
          b.v[pap][1] = 0;
      }
  }
}
void clr() {
  memset(nxt, 0, (id + 2) * 4 * 26);
  memset(fail, 0, (id + 2) * 4);
  memset(cnt, 0, (id + 2) * 4);
  id = 1;
}
int n;
long long m;
int v[N];
int main() {
  while (~scanf("%d%lld", &n, &m)) {
    a.O();
    a.v[1][1] = 0;
    b.O();
    clr();
    for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
    for (int i = 1; i <= n; ++i) {
      scanf("%s", s);
      insert(s, v[i]);
    }
    AC_automation();
    c = a * (b ^ m);
    long long ans = 0;
    for (int i = 1; i <= id; ++i) gmax(ans, c.v[1][i]);
    printf("%lld\n", ans);
  }
  return 0;
}
