#include <bits/stdc++.h>
using namespace std;
inline bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x) == 1; }
inline bool SR(char *s) { return scanf("%s", s) == 1; }
inline bool RI() { return true; }
template <typename I, typename... T>
inline bool RI(I &x, T &...tail) {
  return SR(x) && RI(tail...);
}
inline void SP(const int x) { printf("%d", x); }
inline void SP(const long long x) { printf("%lld", x); }
inline void SP(const double x) { printf("%.16lf", x); }
inline void SP(const char *s) { printf("%s", s); }
inline void PL() { puts(""); }
template <typename I, typename... T>
inline void PL(const I x, const T... tail) {
  SP(x);
  if (sizeof...(tail)) putchar(' ');
  PL(tail...);
}
template <typename I>
void _DOING(const char *s, I &&x) {
  cerr << s << " = " << x << endl;
}
template <typename I, typename... T>
void _DOING(const char *s, I &&x, T &&...tail) {
  int c = 0;
  while (*s != ',' || c != 0) {
    if (*s == '(' || *s == '[' || *s == '{') c++;
    if (*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1, tail...);
}
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) & 0x7fffffff;
}
const int MAX_N = 200 + 10;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
struct Matrix {
  long long a[MAX_N][MAX_N];
  int r, c;
  Matrix(int _r = 0, int _c = 0) : r(_r), c(_c) {
    for (int i = 0; i < int(_r); i++) {
      for (int j = 0; j < int(_c); j++)
        if (i == j)
          a[i][j] = 0;
        else
          a[i][j] = -INF;
    }
  }
};
inline Matrix operator*(const Matrix &a, const Matrix &b) {
  Matrix c(a.r, b.c);
  for (int k = 0; k < int(a.c); k++) {
    for (int i = 0; i < int(a.r); i++) {
      for (int j = 0; j < int(b.c); j++)
        c.a[i][j] = max(c.a[i][j], a.a[i][k] + b.a[k][j]);
    }
  }
  return c;
}
inline Matrix power(Matrix a, long long n) {
  Matrix x(a.r, a.c);
  while (n) {
    if (n & 1) x = x * a;
    a = a * a;
    n >>= 1;
  }
  return x;
}
int id_cnt;
struct Node {
  Node *nxt[26], *fail;
  int id;
  long long val;
  Node() {
    memset(nxt, (0), sizeof(nxt));
    ;
    fail = NULL;
    id = id_cnt++;
    val = 0;
  }
};
Node *root = NULL;
inline void insert(char *s, long long val) {
  Node *p = root;
  while (*s) {
    if (!p->nxt[*s - 'a']) p->nxt[*s - 'a'] = new Node();
    p = p->nxt[*s - 'a'], s++;
  }
  p->val += val;
}
inline void build_ac() {
  queue<Node *> que;
  que.push(root);
  while (!que.empty()) {
    Node *u = que.front();
    que.pop();
    for (int i = 0; i < int(26); i++) {
      if (u->nxt[i]) {
        if (u == root)
          u->nxt[i]->fail = root;
        else {
          Node *p = u->fail;
          while (p) {
            if (!p->nxt[i])
              p = p->fail;
            else
              break;
          }
          if (p)
            u->nxt[i]->fail = p->nxt[i], u->nxt[i]->val += p->nxt[i]->val;
          else
            u->nxt[i]->fail = root;
        }
        que.push(u->nxt[i]);
      }
    }
  }
}
Matrix mat;
inline void build_mat() {
  queue<Node *> que;
  que.push(root);
  mat = Matrix(id_cnt, id_cnt);
  while (!que.empty()) {
    Node *u = que.front();
    que.pop();
    for (int i = 0; i < int(26); i++) {
      if (u->nxt[i]) {
        mat.a[u->id][u->nxt[i]->id] = u->nxt[i]->val;
        que.push(u->nxt[i]);
      } else {
        Node *p = u->fail;
        while (p) {
          if (!p->nxt[i])
            p = p->fail;
          else
            break;
        }
        if (p) mat.a[u->id][p->nxt[i]->id] = p->nxt[i]->val;
      }
    }
  }
}
long long a[MAX_N];
char str[MAX_N];
int main() {
  root = new Node();
  int n;
  long long l;
  RI(n, l);
  for (int i = 0; i < int(n); i++) RI(a[i]);
  for (int i = 0; i < int(n); i++) {
    RI(str);
    insert(str, a[i]);
  }
  build_ac();
  build_mat();
  Matrix x = power(mat, l);
  long long ans = 0;
  for (int i = 0; i < int(id_cnt); i++) ans = max(ans, x.a[0][i]);
  PL(ans);
  return 0;
}
