#include <bits/stdc++.h>
using namespace std;
const int N = 201;
int sz;
long long mat[N][N] = {}, res[N][N] = {}, tmp[N][N] = {}, tr[N][N];
const long long INF = 1e18;
void matMul(long long (&a)[N][N], long long (&b)[N][N]) {
  for (int i = 0; i < (int)(sz); ++i)
    for (int j = 0; j < (int)(sz); ++j) {
      tr[i][j] = b[j][i];
    }
  for (int i = 0; i < (int)(sz); ++i)
    for (int j = 0; j < (int)(sz); ++j) {
      long long res = -INF;
      for (int k = 0; k < (int)(sz); ++k) {
        res = max(res, a[i][k] + tr[j][k]);
      }
      tmp[i][j] = res;
    }
  for (int i = 0; i < (int)(sz); ++i)
    for (int j = 0; j < (int)(sz); ++j) a[i][j] = tmp[i][j];
}
void matPow(long long p) {
  for (int i = 0; i < (int)(sz); ++i)
    for (int j = 0; j < (int)(sz); ++j) res[i][j] = i == j ? 0 : -INF;
  while (p) {
    if (p & 1) matMul(res, mat);
    p >>= 1;
    if (p) matMul(mat, mat);
  }
}
struct AC {
  int nx[205][26] = {};
  int suf[205], term[205];
  int q[205];
  int cnt = 1;
  void addString(string s, int val) {
    int pos = 0;
    for (char cc : s) {
      int c = cc - 'a';
      if (!nx[pos][c]) {
        nx[pos][c] = cnt++;
      }
      pos = nx[pos][c];
    }
    term[pos] += val;
  }
  void build() {
    q[0] = 0;
    for (int qh = 0, qt = 1; qh < qt; ++qh) {
      int v = q[qh];
      if (v != 0) term[v] += term[suf[v]];
      for (int i = 0; i < (int)(26); ++i)
        if (nx[v][i]) {
          q[qt++] = nx[v][i];
          if (v == 0)
            suf[nx[v][i]] = 0;
          else
            suf[nx[v][i]] = nx[suf[v]][i];
        } else {
          nx[v][i] = nx[suf[v]][i];
        }
    }
  }
};
int m;
long long n;
string s;
int a[205];
AC ac;
int main() {
  ios_base::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  cin >> m >> n;
  for (int i = 0; i < (int)(m); ++i) cin >> a[i];
  for (int i = 0; i < (int)(m); ++i) {
    cin >> s;
    ac.addString(s, a[i]);
  }
  ac.build();
  sz = ac.cnt;
  for (int i = 0; i < (int)(sz); ++i)
    for (int j = 0; j < (int)(sz); ++j) mat[i][j] = -INF;
  for (int i = 0; i < (int)(sz); ++i)
    for (int j = 0; j < (int)(26); ++j)
      if (ac.nx[i][j]) {
        mat[i][ac.nx[i][j]] = ac.term[ac.nx[i][j]];
      }
  matPow(n);
  long long ans = 0;
  for (int i = 0; i < (int)(sz); ++i) ans = max(ans, res[0][i]);
  cout << ans << endl;
  return 0;
}
