#include <bits/stdc++.h>
using namespace std;
const int N = 200 + 5;
const int C = 26;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int n, m, v[N];
char s[N];
long long k;
struct matrix {
  long long a[N][N];
  void init() { memset(a, -inf - 1, sizeof(a)); }
  void unit() {
    init();
    for (int i = 0; i < n; i++) a[i][i] = 0;
  }
} A;
template <class T>
void relax(T &a, T b) {
  if (a < b) a = b;
}
matrix mul(matrix &A, matrix &B) {
  matrix C;
  C.init();
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++)
      for (int k = 0; k < m; k++) relax(C.a[i][j], A.a[i][k] + B.a[k][j]);
  return C;
}
matrix pow(matrix A, long long b) {
  matrix C;
  C.unit();
  while (b) {
    if (b & 1) C = mul(C, A);
    b >>= 1;
    A = mul(A, A);
  }
  return C;
}
struct AhoCorasicAutomaton {
  int go[N][C], fail[N], val[N];
  int tot, root;
  int newNode() {
    memset(go[tot], 0, sizeof(go[tot]));
    fail[tot] = val[tot] = 0;
    return tot++;
  }
  void init() {
    tot = 0;
    root = newNode();
  }
  void insert(char *s, int v) {
    int u = root;
    for (int i = 0; s[i]; i++) {
      int c = s[i] - 'a';
      if (!go[u][c]) go[u][c] = newNode();
      u = go[u][c];
    }
    val[u] += v;
  }
  void build() {
    queue<int> Q;
    Q.push(root);
    while (!Q.empty()) {
      int u = Q.front();
      Q.pop();
      val[u] += val[fail[u]];
      for (int i = 0; i < C; i++) {
        if (go[u][i]) {
          if (!u)
            fail[go[u][i]] = 0;
          else
            fail[go[u][i]] = go[fail[u]][i];
          Q.push(go[u][i]);
        } else
          go[u][i] = go[fail[u]][i];
      }
    }
  }
  matrix get() {
    matrix A;
    m = tot;
    A.init();
    for (int i = 0; i < tot; i++)
      for (int j = 0; j < C; j++) A.a[i][go[i][j]] = val[go[i][j]];
    return A;
  }
} AC;
int main() {
  AC.init();
  scanf("%d%lld", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    AC.insert(s, v[i]);
  }
  AC.build();
  A = AC.get();
  A = pow(A, k);
  printf("%lld\n", *max_element(A.a[0], A.a[0] + m));
  return 0;
}
