#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 28;
const long long LINF = 1ll << 61;
inline long long getnum() {
  register long long r = 0;
  register bool ng = 0;
  register char c;
  c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') ng = 1, c = getchar();
  while (c != ' ' && c != '\n') r = r * 10 + c - '0', c = getchar();
  if (ng) r = -r;
  return r;
}
template <class T>
inline void putnum(T x) {
  if (x < 0) putchar('-'), x = -x;
  register short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
inline void putsp() { putchar(' '); }
inline void putendl() { putchar('\n'); }
inline char mygetchar() {
  register char c = getchar();
  while (c == ' ' || c == '\n') c = getchar();
  return c;
}
int size;
struct matrix {
  long long a[202][202];
  void init() { memset(a, 0, sizeof(a)); }
  matrix() { init(); }
  void set1() {
    for (int i = 1; i <= size; i++)
      for (int j = 1; j <= size; j++) a[i][j] = (i == j ? 0 : -LINF);
  }
  matrix operator*(const matrix &t) {
    matrix ans;
    for (int i = 1; i <= size; i++) {
      for (int j = 1; j <= size; j++) {
        ans.a[i][j] = -LINF;
        for (int k = 1; k <= size; k++) {
          ans.a[i][j] = max(ans.a[i][j], a[i][k] + t.a[k][j]);
        }
      }
    }
    return ans;
  }
  void out() {
    for (int i = 1; i <= size; i++) {
      for (int j = 1; j <= size; j++) {
        if (a[i][j] < 0)
          cout << "-inf ";
        else
          cout << a[i][j] << " ";
      }
      cout << endl;
    }
    cout << endl;
  }
} A;
matrix kissme(matrix x, long long k) {
  matrix ans;
  ans.set1();
  while (k > 0) {
    if (k & 1) ans = ans * x;
    x = x * x;
    k >>= 1;
  }
  return ans;
}
int que[211], quesz, nxt[211][26], w[211];
struct AC {
  struct node {
    int p, fail, go[26];
  } a[211];
  int rt, tot;
  int newnode(int p) {
    tot++;
    a[tot].fail = 0;
    memset(a[tot].go, 0, sizeof(a[tot].go));
    a[tot].p = p;
    return tot;
  }
  AC() {
    tot = 0;
    rt = newnode(0);
    a[rt].fail = rt;
  }
  void insert(char s[], int sz, int wi) {
    int p = rt;
    for (int i = 0; i < sz; i++) {
      if (!a[p].go[s[i] - 'a']) a[p].go[s[i] - 'a'] = newnode(p);
      p = a[p].go[s[i] - 'a'];
    }
    w[p] += wi;
  }
  void init() {
    quesz = 0;
    que[quesz++] = rt;
    for (int i = 0; i < quesz; i++) {
      int p = que[i];
      for (int j = 0; j < 26; j++) {
        int q = a[p].go[j];
        if (q) {
          que[quesz++] = q;
          if (p == rt)
            a[q].fail = rt;
          else {
            int t = a[p].fail;
            while (t != rt && !a[t].go[j]) t = a[t].fail;
            if (a[t].go[j])
              a[q].fail = a[t].go[j];
            else
              a[q].fail = rt;
          }
          w[q] += w[a[q].fail];
        }
      }
    }
    for (int i = 1; i <= tot; i++) {
      for (int j = 0; j < 26; j++) {
        int p = i;
        while (p != rt && !a[p].go[j]) p = a[p].fail;
        if (a[p].go[j])
          nxt[i][j] = a[p].go[j];
        else
          nxt[i][j] = rt;
      }
    }
  }
} meiko;
char s[211];
long long L;
int n, tw[211];
int main() {
  cin >> n >> L;
  for (int i = 1; i <= n; i++) scanf("%d", &tw[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    int len = strlen(s);
    meiko.insert(s, len, tw[i]);
  }
  meiko.init();
  size = meiko.tot;
  for (int i = 1; i <= size; i++)
    for (int j = 1; j <= size; j++) A.a[i][j] = -LINF;
  for (int i = 1; i <= size; i++) {
    for (int j = 0; j < 26; j++) {
      if (nxt[i][j]) {
        A.a[i][nxt[i][j]] = w[nxt[i][j]];
      }
    }
  }
  A = kissme(A, L);
  long long ans = 0;
  for (int i = 1; i <= size; i++) {
    ans = max(ans, A.a[1][i]);
  }
  cout << ans << endl;
  return 0;
}
