#include <bits/stdc++.h>
using namespace std;
const int maxnode = 20010;
const int sigma_size = 26;
long long idx[256];
void init_idx() {
  for (long long i = 'a'; i <= 'z'; i++) idx[i] = i - 'a';
}
struct AhoCorasickAutomata {
  long long ch[maxnode][sigma_size];
  long long val[maxnode], f[maxnode], sum[maxnode];
  long long sz;
  void init() {
    sz = 1;
    memset(ch[0], 0, sizeof(ch[0]));
  }
  void insert(char* s, long long v) {
    long long u = 0, n = strlen(s);
    for (long long i = 0; i < n; i++) {
      long long c = idx[s[i]];
      if (!ch[u][c]) {
        val[sz] = sum[sz] = 0;
        memset(ch[sz], 0, sizeof(ch[sz]));
        ch[u][c] = sz++;
      }
      u = ch[u][c];
    }
    val[u] += v;
    sum[u] = val[u];
  }
  void getFail() {
    queue<long long> q;
    f[0] = 0;
    for (long long c = 0; c < sigma_size; c++) {
      long long u = ch[0][c];
      if (u) {
        f[u] = 0;
        q.push(u);
      }
    }
    while (!q.empty()) {
      long long r = q.front();
      q.pop();
      for (long long c = 0; c < sigma_size; c++) {
        long long u = ch[r][c];
        if (!u) {
          ch[r][c] = ch[f[r]][c];
          continue;
        }
        q.push(u);
        long long v = f[r];
        while (v && !ch[v][c]) v = f[v];
        f[u] = ch[v][c];
        sum[u] = val[u] + sum[f[u]];
      }
    }
  }
} ac;
struct Matrix {
  long long n;
  long long a[210][210];
  Matrix operator*(Matrix& rhs) {
    Matrix ret;
    ret.n = n;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < n; j++) {
        ret.a[i][j] = -1;
        for (long long k = 0; k < n; k++)
          if (a[i][k] != -1 && rhs.a[k][j] != -1)
            ret.a[i][j] = max(ret.a[i][j], a[i][k] + rhs.a[k][j]);
      }
    return ret;
  }
};
Matrix gen_matrix() {
  Matrix ret;
  ret.n = ac.sz;
  memset(ret.a, -1, sizeof(ret.a));
  for (long long i = 0; i < ret.n; i++) {
    for (long long c = 0; c < sigma_size; c++) {
      long long j = ac.ch[i][c];
      ret.a[i][j] = max(ret.a[i][j], ac.sum[j]);
    }
  }
  return ret;
}
Matrix q_pow(Matrix A, long long k) {
  Matrix ret;
  ret.n = A.n;
  bool fir = true;
  while (k) {
    if (k & 1ll) {
      if (fir)
        ret = A;
      else
        ret = ret * A;
      fir = false;
    }
    k >>= 1ll;
    A = A * A;
  }
  return ret;
}
Matrix res;
long long v[210];
char s[210];
int main() {
  init_idx();
  long long num, k;
  while (~scanf("%lld%lld", &num, &k)) {
    ac.init();
    for (long long i = 0; i < num; i++) scanf("%lld", &v[i]);
    for (long long i = 0; i < num; i++) {
      scanf("%s", s);
      ac.insert(s, v[i]);
    }
    ac.getFail();
    res = gen_matrix();
    res = q_pow(res, k);
    long long ans = 0;
    for (long long i = 0; i < res.n; i++) ans = max(ans, res.a[0][i]);
    printf("%lld\n", ans);
  }
  return 0;
}
