#include <bits/stdc++.h>
using namespace std;
const int N = 205;
const int64_t inf = 1e18;
int64_t n, l, a[N];
struct AhoCorasick {
  int nxt[N][26], link[N], node = 0;
  int child[N][26];
  int64_t sum[N];
  vector<int> G[N];
  AhoCorasick() {
    memset(nxt, 0, sizeof nxt);
    memset(child, 0, sizeof child);
    memset(sum, 0, sizeof sum);
    memset(link, 0, sizeof link);
  }
  void add(string &S, int64_t val) {
    int cur_node = 0;
    for (int i = 0; i < (int)S.size(); ++i) {
      int ch = S[i] - 'a';
      if (child[cur_node][ch] == 0) child[cur_node][ch] = ++node;
      cur_node = child[cur_node][ch];
    }
    sum[cur_node] += val;
  }
  void bfs() {
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      for (int i = 0; i < 26; ++i) {
        int v = child[u][i];
        nxt[u][i] = nxt[link[u]][i];
        if (v) {
          link[v] = nxt[u][i];
          nxt[u][i] = v, q.push(v);
        }
      }
    }
  }
  void dfs(int u) {
    for (int v : G[u]) sum[v] += sum[u], dfs(v);
  }
  void init() {
    bfs();
    for (int i = 1; i <= node; ++i) G[link[i]].push_back(i);
    dfs(0);
  }
} Aho;
struct Matrix {
  int64_t M[N][N];
  Matrix() {
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < N; ++j) M[i][j] = -inf;
  }
  Matrix operator*(Matrix &b) {
    Matrix tmp;
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < N; ++j)
        for (int k = 0; k < N; ++k)
          tmp.M[i][j] = max(tmp.M[i][j], M[i][k] + b.M[k][j]);
    return tmp;
  }
} Base;
struct Vector {
  int64_t M[N];
  Vector() {
    for (int i = 0; i < N; ++i) M[i] = -inf;
  }
  Vector operator*(Matrix b) {
    Vector tmp;
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < N; ++j) tmp.M[i] = max(tmp.M[i], M[j] + b.M[j][i]);
    return tmp;
  }
};
Matrix pow(Matrix &x, int64_t b) {
  if (b == 1) return x;
  Matrix X = pow(x, b >> 1);
  X = X * X;
  return (b & 1) ? (X * x) : X;
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> l;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    Aho.add(s, a[i]);
  }
  Aho.init();
  Vector State;
  State.M[0] = 0;
  for (int i = 0; i <= Aho.node; ++i)
    for (int j = 0; j < 26; ++j)
      Base.M[i][Aho.nxt[i][j]] = Aho.sum[Aho.nxt[i][j]];
  State = State * pow(Base, l);
  int64_t ans = 0;
  for (int i = 0; i <= Aho.node; ++i) ans = max(ans, State.M[i]);
  cout << ans << endl;
  cerr << fixed << setprecision(6) << (double)clock() / CLOCKS_PER_SEC << endl;
}
