#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e2 + 10;
const long long Sigma = 26;
const long long INF = 1e16 + 10;
string s[MAXN];
long long w[MAXN][MAXN][MAXN];
long long fa[MAXN][MAXN][Sigma];
long long b[MAXN][MAXN];
long long f[MAXN][MAXN];
long long num[MAXN][MAXN];
long long temp[MAXN][MAXN];
long long matrix[MAXN][MAXN];
long long a[MAXN];
void mult(long long a[MAXN][MAXN], long long b[MAXN][MAXN],
          long long c[MAXN][MAXN]) {
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      temp[i][j] = -INF;
      for (int u = 0; u < MAXN; u++) {
        temp[i][j] = max(temp[i][j], b[i][u] + c[u][j]);
      }
    }
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      a[i][j] = temp[i][j];
    }
  }
}
void matrix_pw(long long k) {
  if (k == 1) {
    return;
  }
  matrix_pw(k / 2);
  mult(matrix, matrix, matrix);
  if (k & 1) {
    mult(matrix, matrix, b);
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  long long n, l, t = 0, res = 0;
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 2; j <= (long long)(s[i].size()); j++) {
      f[i][j] = f[i][j - 1];
      while (f[i][j] > 0 && s[i][f[i][j]] != s[i][j - 1]) {
        f[i][j] = f[i][f[i][j]];
      }
      if (s[i][f[i][j]] == s[i][j - 1]) {
        f[i][j]++;
      }
    }
    for (int j = 0; j <= (long long)(s[i].size()); j++) {
      for (int u = 0; u < Sigma; u++) {
        if (j != (long long)(s[i].size()) && (s[i][j] - 'a') == u) {
          fa[i][j][u] = j + 1;
        } else {
          fa[i][j][u] = fa[i][f[i][j]][u];
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s[i].size(); j++) {
      if (i == 0 || j > 0) {
        num[i][j] = t++;
      }
    }
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      matrix[i][j] = -INF;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= s[i].size(); j++) {
      for (int z = 0; z < Sigma; z++) {
        long long ans = 0;
        pair<long long, long long> k = make_pair(0, 0);
        for (int u = 0; u < n; u++) {
          if (j == 0) {
            w[i][j][u] = 0;
          } else {
            w[i][j][u] = fa[u][w[i][j - 1][u]][s[i][j - 1] - 'a'];
          }
          k = max(k, make_pair(fa[u][w[i][j][u]][z], 1LL * u));
          if (fa[u][w[i][j][u]][z] == (long long)(s[u].size())) {
            ans += a[u];
          }
        }
        if (k.first == 0) {
          k.second = 0;
        }
        if (i == 0 || j > 0) {
          matrix[num[i][j]][num[k.second][k.first]] =
              max(matrix[num[i][j]][num[k.second][k.first]], ans);
        }
      }
    }
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      b[i][j] = matrix[i][j];
    }
  }
  matrix_pw(l);
  for (int i = 0; i < MAXN; i++) {
    res = max(res, matrix[0][i]);
  }
  cout << res;
}
