#include <bits/stdc++.h>
using namespace std;
const int MAX_NODES = 205, LEN_PATTERN = 205, NUM_LETTER = 26;
inline int char2int(char c) { return c - 'a'; }
struct Node {
  Node() { init(); }
  Node *son[NUM_LETTER], *father, *suffix;
  int ch;
  long long score;
  void init() {
    for (int i = 0; i < NUM_LETTER; ++i) son[i] = NULL;
    father = suffix = NULL;
    ch = 0;
    score = 0;
  }
};
struct ACAutomaton {
  int now;
  Node v[MAX_NODES], *root;
  void init() {
    now = 1;
    v[0].init();
    root = &v[0];
    root->father = root;
    root->ch = -1;
  }
  void insert(char s[], long long score) {
    Node *x = root;
    int l = strlen(s);
    for (int i = 0; i < l; ++i) {
      int k = char2int(s[i]);
      if (NULL == x->son[k]) {
        v[now].init();
        x->son[k] = &v[now];
        v[now].father = x;
        v[now].ch = k;
        ++now;
      }
      x = x->son[k];
    }
    x->score += score;
  }
  void build() {
    queue<Node *> Q;
    root->suffix = root;
    for (int i = 0; i < NUM_LETTER; ++i) {
      if (NULL == root->son[i])
        root->son[i] = root;
      else {
        root->son[i]->suffix = root;
        Q.push(root->son[i]);
      }
    }
    while (!Q.empty()) {
      Node *x = Q.front();
      Q.pop();
      if (NULL == x->suffix) x->suffix = x->father->suffix->son[x->ch];
      x->score += x->suffix->score;
      for (int i = 0; i < NUM_LETTER; ++i)
        if (NULL == x->son[i])
          x->son[i] = x->suffix->son[i];
        else
          Q.push(x->son[i]);
    }
  }
} acAutomaton;
const int MAXN = 205;
const long long INFTY = 0x3fffffffffffffffLL;
char s[LEN_PATTERN];
long long L, f[50][205][205], g[50][205][205];
int N, scores[MAXN];
void solve2(long long steps, int d) {
  int M = acAutomaton.now;
  if (steps == 1) {
    for (int i = 0; i < M; ++i)
      for (int j = 0; j < M; ++j)
        if (acAutomaton.v[i].son[acAutomaton.v[j].ch] == &(acAutomaton.v[j]))
          f[d][i][j] = acAutomaton.v[j].score;
        else
          f[d][i][j] = -INFTY;
    return;
  }
  long long half = steps >> 1;
  for (int i = 0; i < M; ++i)
    for (int j = 0; j < M; ++j) f[d + 1][i][j] = g[d + 1][i][j] = -INFTY;
  solve2(half, d + 1);
  if (steps & 1) {
    for (int i = 0; i < M; ++i)
      for (int j = 0; j < M; ++j)
        for (int k = 0; k < M; ++k)
          if (acAutomaton.v[k].son[acAutomaton.v[j].ch] == &(acAutomaton.v[j]))
            g[d + 1][i][j] =
                max(g[d + 1][i][j], f[d + 1][i][k] + acAutomaton.v[j].score);
  } else {
    for (int i = 0; i < M; ++i)
      for (int j = 0; j < M; ++j) g[d + 1][i][j] = f[d + 1][i][j];
  }
  for (int k = 0; k < M; ++k)
    for (int i = 0; i < M; ++i)
      for (int j = 0; j < M; ++j)
        f[d][i][j] = max(f[d][i][j], f[d + 1][i][k] + g[d + 1][k][j]);
}
long long solve() {
  solve2(L, 0);
  int M = acAutomaton.now;
  long long ans = 0;
  for (int i = 1; i < M; ++i) ans = max(ans, f[0][0][i]);
  return ans;
}
int main() {
  int N, t;
  acAutomaton.init();
  scanf("%d%I64d", &N, &L);
  for (int i = 0; i < N; ++i) scanf("%d", &scores[i]);
  for (int i = 0; i < N; ++i) scanf(" %s", s), acAutomaton.insert(s, scores[i]);
  acAutomaton.build();
  printf("%I64d\n", solve());
  return 0;
}
