#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return a > val ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
struct matrix {
  static const int MAXN = 210;
  long long x[MAXN][MAXN];
  matrix() { memset(x, 0, sizeof(x)); }
  matrix unit() {
    matrix res;
    for (int i = 0; i < MAXN; i++) res.x[i][i] = 1;
    return res;
  }
  matrix operator*(matrix A) {
    matrix res;
    for (int i = (0); i < (MAXN); i++)
      for (int j = (0); j < (MAXN); j++) res.x[i][j] = -LINF;
    for (int i = 0; i < MAXN; i++)
      for (int k = 0; k < MAXN; k++)
        for (int j = 0; j < MAXN; j++) {
          if (x[i][k] != -LINF && A.x[k][j] != -LINF) {
            chkmax(res.x[i][j], x[i][k] + A.x[k][j]);
          }
        }
    return res;
  }
  matrix operator^(long long k) {
    if (!k) return unit();
    matrix res, tmp;
    for (int i = 0; i < MAXN; i++)
      for (int j = 0; j < MAXN; j++) {
        res.x[i][j] = tmp.x[i][j] = x[i][j];
      }
    k--;
    while (k) {
      if (k & 1) res = res * tmp;
      tmp = tmp * tmp;
      k >>= 1;
    }
    return res;
  }
};
const int MAXN = 100010;
const int MAXC = 26;
struct Node {
  Node* parent;
  Node* child[MAXC];
  Node* bfail;
  Node* gfail;
  int key, cost, sum;
  char val;
  Node() {
    bfail = 0;
    key = -1, cost = sum = 0;
  }
} node[MAXN];
Node* alloc = node;
Node* q[MAXN];
Node* root = alloc++;
Node* insert(Node* x, string s, int key, int cost) {
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - 'a';
    if (!x->child[c]) {
      x->child[c] = alloc++;
      x->child[c]->val = c;
      x->child[c]->parent = x;
    }
    x = x->child[c];
  }
  x->key = key;
  x->cost += cost;
  return x;
}
void pushlink(Node* root) {
  int b = 0, e = 0;
  q[e++] = root;
  while (b < e) {
    Node* x = q[b++];
    for (int i = 0; i < MAXC; i++) {
      if (x->child[i]) q[e++] = x->child[i];
    }
    if (x == root || x->parent == root) {
      x->bfail = root;
      x->gfail = 0;
    } else {
      x->bfail = x->parent->bfail;
      while (x->bfail != root && !x->bfail->child[x->val])
        x->bfail = x->bfail->bfail;
      if (x->bfail->child[x->val]) x->bfail = x->bfail->child[x->val];
      if (x->bfail->key != -1)
        x->gfail = x->bfail;
      else
        x->gfail = x->bfail->gfail;
    }
  }
}
const int maxn = 210;
int n;
long long l;
int a[maxn];
string s[maxn];
matrix A;
void upd(Node* x) {
  Node* tmp = x;
  while (1) {
    x->sum += tmp->cost;
    if (tmp == root) {
      break;
    }
    tmp = tmp->bfail;
  }
  for (int i = 0; i < MAXC; i++) {
    if (x->child[i]) {
      upd(x->child[i]);
    }
  }
}
void build(Node* x) {
  for (int i = (0); i < (MAXC); i++) {
    if (x->child[i]) {
      build(x->child[i]);
    }
  }
  Node* tmp = x;
  while (1) {
    for (int i = (0); i < (MAXC); i++) {
      Node* y = tmp->child[i];
      if (y) {
        int u = x - root;
        int v = y - root;
        A.x[u][v] = y->sum;
      }
    }
    if (tmp == root) {
      break;
    }
    tmp = tmp->bfail;
  }
}
void solve() {
  cin >> n >> l;
  for (int i = (0); i < (n); i++) cin >> a[i];
  for (int i = (0); i < (n); i++) {
    cin >> s[i];
    insert(root, s[i], i, a[i]);
  }
  for (int i = (0); i < (A.MAXN); i++)
    for (int j = (0); j < (A.MAXN); j++) A.x[i][j] = -LINF;
  pushlink(root);
  upd(root);
  build(root);
  A = A ^ l;
  long long ans = 0;
  for (int i = (0); i < (A.MAXN); i++) {
    chkmax(ans, A.x[0][i]);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
