#include <bits/stdc++.h>
using namespace std;
const int N = 205;
const int M = 205;
const int CHAR_SIZE = 26;
const int Mat_SIZE = 201;
const int MOD = 20090717;
const int INF = 0x3f3f3f3f;
struct ACMachine {
  int tot, rt;
  int ch[N][CHAR_SIZE], val[N], fail[N];
  void init() {
    tot = 0;
    rt = tot++;
    memset(ch[rt], 0, sizeof(ch[rt]));
    val[rt] = 0;
  }
  int idx(char c) { return c - 'a'; }
  void Insert(char *s, int v) {
    int len = strlen(s);
    int u = rt;
    for (int i = 0; i < len; i++) {
      int c = idx(s[i]);
      if (!ch[u][c]) {
        memset(ch[tot], 0, sizeof(ch[tot]));
        val[tot] = 0;
        ch[u][c] = tot++;
      }
      u = ch[u][c];
    }
    val[u] += v;
  }
  void get_fail() {
    queue<int> q;
    while (!q.empty()) q.pop();
    fail[rt] = rt;
    for (int i = 0; i < CHAR_SIZE; i++) {
      int u = ch[rt][i];
      if (u) {
        q.push(u);
        fail[u] = rt;
      }
    }
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      val[u] += val[fail[u]];
      for (int i = 0; i < CHAR_SIZE; i++) {
        int v = ch[u][i];
        if (!v) {
          ch[u][i] = ch[fail[u]][i];
          continue;
        }
        fail[v] = ch[fail[u]][i];
        q.push(v);
      }
    }
  }
} ac;
struct Matrix {
  long long mat[Mat_SIZE][Mat_SIZE];
  int _n;
  void init(int sz, int v) {
    _n = sz;
    for (int i = 0; i < _n; i++)
      for (int j = 0; j < _n; j++) mat[i][j] = v;
  }
  void init_base(int sz) {
    init(sz, 0);
    for (int i = 0; i < sz; i++) mat[i][i] = 1;
  }
  void display() {
    for (int i = 0; i < _n; i++) {
      for (int j = 0; j < _n; j++) cout << mat[i][j] << ' ';
      cout << endl;
    }
    cout << endl;
  }
} A, B;
Matrix operator*(const Matrix &a, const Matrix &b) {
  Matrix c;
  int _n = a._n;
  c._n = a._n;
  for (int i = 0; i < _n; i++)
    for (int j = 0; j < _n; j++) {
      c.mat[i][j] = -1;
      for (int k = 0; k < _n; k++)
        if (a.mat[i][k] != -1 && b.mat[k][j] != -1)
          c.mat[i][j] = max(c.mat[i][j], a.mat[i][k] + b.mat[k][j]);
    }
  return c;
}
Matrix operator^(Matrix a, long long k) {
  Matrix ret = A;
  while (k) {
    if (k & 1) ret = ret * a;
    a = a * a;
    k >>= 1;
  }
  return ret;
}
void solve(long long k) {
  A.init(ac.tot, -1);
  for (int i = 0; i < ac.tot; i++) A.mat[i][i] = 0;
  B.init(ac.tot, -1);
  for (int i = 0; i < ac.tot; i++)
    for (int j = 0; j < CHAR_SIZE; j++) {
      int son = ac.ch[i][j];
      B.mat[i][son] = ac.val[son];
    }
  B = B ^ k;
  long long ans = 0;
  for (int i = 0; i < ac.tot; i++) ans = max(ans, B.mat[0][i]);
  printf("%I64d\n", ans);
}
int n;
long long l;
int a[N];
char s[N];
int main() {
  scanf("%d%I64d", &n, &l);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  ac.init();
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    ac.Insert(s, a[i]);
  }
  ac.get_fail();
  solve(l);
  return 0;
}
