#include <bits/stdc++.h>
using namespace std;
const int N = 200 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-8;
const double PI = acos(-1);
template <class T, class S>
inline void add(T& a, S b) {
  a += b;
  if (a >= mod) a -= mod;
}
template <class T, class S>
inline void sub(T& a, S b) {
  a -= b;
  if (a < 0) a += mod;
}
template <class T, class S>
inline bool chkmax(T& a, S b) {
  return a < b ? a = b, true : false;
}
template <class T, class S>
inline bool chkmin(T& a, S b) {
  return a > b ? a = b, true : false;
}
int n, a[N];
long long l;
char s[N][N];
int MN;
struct Matrix {
  long long a[207][207];
  Matrix() {
    for (int i = 0; i < MN; i++)
      for (int j = 0; j < MN; j++) a[i][j] = 0;
  }
  void init() {
    for (int i = 0; i < MN; i++)
      for (int j = 0; j < MN; j++) a[i][j] = -INF;
  }
  Matrix operator*(const Matrix& B) const {
    Matrix C;
    C.init();
    for (int i = 0; i < MN; i++)
      for (int j = 0; j < MN; j++)
        for (int k = 0; k < MN; k++) chkmax(C.a[i][j], a[i][k] + B.a[k][j]);
    return C;
  }
  Matrix operator^(long long b) {
    Matrix C = (*this);
    Matrix A = (*this);
    b--;
    while (b) {
      if (b & 1) C = C * A;
      A = A * A;
      b >>= 1;
    }
    return C;
  }
} M;
struct Ac {
  int ch[N][26], f[N], tot, sz, subVal;
  int val[N];
  inline int newNode() {
    tot++;
    f[tot] = 0;
    memset(ch[tot], 0, sizeof(ch[tot]));
    return tot;
  }
  void init(int _sz, int _subVal) {
    sz = _sz;
    subVal = _subVal;
    tot = -1;
    newNode();
  }
  inline int idx(int c) { return c - subVal; }
  void addStr(char* s, int w) {
    int u = 0;
    for (int i = 0; s[i]; i++) {
      int c = idx(s[i]);
      if (!ch[u][c]) ch[u][c] = newNode();
      u = ch[u][c];
    }
    val[u] += w;
  }
  void build() {
    queue<int> que;
    for (int c = 0; c < sz; c++) {
      int v = ch[0][c];
      if (!v)
        ch[0][c] = 0;
      else
        f[v] = 0, que.push(v);
    }
    while (!que.empty()) {
      int u = que.front();
      que.pop();
      val[u] += val[f[u]];
      for (int c = 0; c < sz; c++) {
        int v = ch[u][c];
        if (!v)
          ch[u][c] = ch[f[u]][c];
        else
          f[v] = ch[f[u]][c], que.push(v);
      }
    }
  }
  void getMatrix() {
    MN = tot + 1;
    for (int i = 0; i < MN; i++)
      for (int j = 0; j < MN; j++) M.a[i][j] = -INF;
    for (int u = 0; u <= tot; u++) {
      for (int c = 0; c < sz; c++) {
        int v = ch[u][c];
        if (!v) continue;
        chkmax(M.a[u][v], val[v]);
      }
    }
  }
} ac;
int main() {
  ac.init(26, 'a');
  scanf("%d%lld", &n, &l);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%s", s[i]);
  for (int i = 1; i <= n; i++) ac.addStr(s[i], a[i]);
  ac.build();
  ac.getMatrix();
  M = M ^ l;
  long long ans = 0;
  for (int i = 0; i < MN; i++) chkmax(ans, M.a[0][i]);
  printf("%lld\n", ans);
  return 0;
}
