#include <bits/stdc++.h>
using namespace std;
const long long maxn = 200 + 10;
const long long inf = (1ll << 50);
struct Matrix {
  long long mat[205][205];
  long long cnt;
  Matrix(long long _n = 0) {
    cnt = _n;
    for (long long i = 0; i < cnt; i++)
      for (long long j = 0; j < cnt; j++) mat[i][j] = -inf;
  };
  Matrix operator*(const Matrix &b) const {
    Matrix ans = Matrix(cnt);
    for (long long i = 0; i < cnt; i++)
      for (long long j = 0; j < cnt; j++)
        for (long long k = 0; k < cnt; k++)
          ans.mat[i][j] = max(mat[i][k] + b.mat[k][j], ans.mat[i][j]);
    return ans;
  }
} E;
struct AC_automaton {
  long long fail[maxn], last[maxn];
  long long val[maxn];
  long long son[maxn][26], size;
  void Init() {
    memset(son[0], 0, sizeof(son[0]));
    size = 1;
  }
  void Clean(long long x) {
    memset(son[x], 0, sizeof(son[x]));
    val[x] = 0;
  }
  long long make(char x) { return x - 'a'; }
  void Insert(char *s, long long value) {
    long long u = 0;
    long long len = strlen(s);
    for (long long i = 0; i < len; i++) {
      long long c = make(s[i]);
      if (!son[u][c]) {
        Clean(size);
        son[u][c] = size++;
      }
      u = son[u][c];
    }
    val[u] += value;
  }
  void Get_Fail() {
    queue<long long> q;
    long long u = 0, v;
    for (long long i = 0; i < 26; i++) {
      u = son[0][i];
      if (u) {
        q.push(u);
        fail[u] = 0;
        last[u] = 0;
      }
    }
    while (!q.empty()) {
      long long r = q.front();
      q.pop();
      for (long long i = 0; i < 26; i++) {
        u = son[r][i], v = fail[r];
        if (!u) {
          son[r][i] = son[v][i];
          continue;
        }
        q.push(u);
        fail[u] = son[v][i];
        last[u] = val[fail[u]] ? fail[u] : last[fail[u]];
        val[u] += val[last[u]];
      }
    }
  }
  void Get_Matrix(Matrix &ma) {
    for (long long i = 0; i < size; i++)
      for (long long j = 0; j < 26; j++) {
        long long v = son[i][j];
        ma.mat[i][v] = val[v];
      }
  }
} AC;
Matrix Pow_Matrix(Matrix &a, long long k) {
  Matrix ret = E, temp = a;
  while (k) {
    if (k & 1) ret = ret * temp;
    temp = temp * temp;
    k >>= 1;
  }
  return ret;
}
char s[maxn];
long long va[maxn];
long long n;
long long m;
int main() {
  AC.Init();
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) scanf("%lld", &va[i]);
  for (long long i = 1; i <= n; i++) scanf("%s", s), AC.Insert(s, va[i]);
  AC.Get_Fail();
  E = Matrix(AC.size);
  for (long long i = 0; i < AC.size; i++) E.mat[i][i] = 0;
  Matrix ans = Matrix(AC.size);
  AC.Get_Matrix(ans);
  ans = Pow_Matrix(ans, m);
  long long ret = 0;
  for (long long i = 0; i < AC.size; i++) ret = max(ret, ans.mat[0][i]);
  printf("%lld\n", ret);
}
