#include <bits/stdc++.h>
using namespace std;
const int ALF_SIZE = 26;
int val[200], sizeB = 1;
struct bor {
  char q;
  int a[ALF_SIZE];
  int val, par;
  int go[ALF_SIZE];
  int link;
  bool updated;
  void init(int q) {
    this->q = q;
    val = par = 0;
    link = -1;
    updated = 0;
    for (int w = 0; w < ALF_SIZE; w++) {
      a[w] = -1;
      go[w] = -1;
    }
  }
};
bor a[201];
int go(int c, char v);
int get_link(int c) {
  if (a[c].link < 0) {
    if ((c == 0) || (a[c].par == 0)) {
      a[c].link = 0;
    } else {
      a[c].link = go(get_link(a[c].par), a[c].q);
    }
  }
  return a[c].link;
}
int go(int c, char v) {
  if (a[c].go[v] < 0) {
    if (a[c].a[v] >= 0) {
      a[c].go[v] = a[c].a[v];
    } else {
      if (c == 0) {
        a[c].go[v] = 0;
      } else {
        a[c].go[v] = go(get_link(c), v);
      }
    }
  }
  return a[c].go[v];
}
char h[201];
int calc_val(int c) {
  if (a[c].updated == 0) {
    a[c].updated = 1;
    a[c].val += calc_val(get_link(c));
  }
  return a[c].val;
}
long long d[201][201];
void mult(long long **a, long long **s, long long **f) {
  int w, e, r;
  for (e = 0; e < sizeB; e++) {
    for (r = 0; r < sizeB; r++) {
      d[e][r] = -1;
    }
  }
  for (w = 0; w < sizeB; w++) {
    for (e = 0; e < sizeB; e++) {
      for (r = 0; r < sizeB; r++) {
        if ((a[w][e] >= 0) && (s[e][r] >= 0)) {
          d[w][r] = max(d[w][r], a[w][e] + s[e][r]);
        }
      }
    }
  }
  for (e = 0; e < sizeB; e++) {
    for (r = 0; r < sizeB; r++) {
      f[e][r] = d[e][r];
    }
  }
}
int main() {
  int q, w, e, r, t, c, v;
  long long len;
  a[0].init(0);
  cin >> q >> len;
  for (w = 0; w < q; w++) {
    scanf("%d", &val[w]);
  }
  for (w = 0; w < q; w++) {
    scanf("%s", h);
    c = 0;
    for (e = 0; h[e]; e++) {
      h[e] -= 'a';
      if (a[c].a[h[e]] == -1) {
        a[sizeB].init(h[e]);
        a[sizeB].par = c;
        a[c].a[h[e]] = sizeB;
        sizeB++;
      }
      c = a[c].a[h[e]];
    }
    a[c].val += val[w];
  }
  for (w = 0; w < sizeB; w++) {
    calc_val(w);
  }
  long long **s = new long long *[sizeB];
  long long **d = new long long *[sizeB];
  for (e = 0; e < sizeB; e++) {
    s[e] = new long long[sizeB];
    d[e] = new long long[sizeB];
    for (r = 0; r < sizeB; r++) {
      s[e][r] = -1;
      d[e][r] = -1;
    }
  }
  d[0][0] = 0;
  for (e = 0; e < sizeB; e++) {
    for (c = 0; c < 26; c++) {
      if (a[e].a[c] >= 0) {
        v = a[e].a[c];
        s[e][v] = max(s[e][v], (long long)(a[v].val));
      } else {
        v = go(get_link(e), c);
        s[e][v] = max(s[e][v], (long long)a[v].val);
      }
    }
  }
  for (; len; len /= 2) {
    if (len % 2 == 1) {
      mult(d, s, d);
    }
    mult(s, s, s);
  }
  long long ans = 0;
  for (w = 0; w < sizeB; w++) {
    ans = max(ans, d[0][w]);
  }
  cout << ans;
  return 0;
}
