#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 2e18;
namespace AhoCorasick {
const int A = 26;
const int NIL = -1;
struct AhoNode {
  int kid[A], to[A];
  bool leaf = false;
  int link = NIL, p = NIL, val = 0;
  char pch;
  AhoNode(int p = NIL, char c = '$') : p(p), pch(c) {
    memset(kid, NIL, sizeof kid);
    memset(to, NIL, sizeof to);
  }
};
const int root = 0;
vector<AhoNode> t(1);
void add_string(const string &s, int value) {
  int v = root;
  for (char ch : s) {
    int c = ch - 'a';
    if (t[v].kid[c] == NIL) {
      t[v].kid[c] = t.size();
      t.emplace_back(v, ch);
    }
    v = t[v].kid[c];
  }
  t[v].leaf = true;
  t[v].val += value;
}
void damnation() {
  queue<int> q;
  q.push(root);
  t[root].link = root;
  for (int c = 0; c < A; ++c) t[root].to[c] = root;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (u != t[u].link) t[u].val += t[t[u].link].val;
    for (int c = 0; c < A; ++c) {
      int v = t[u].kid[c];
      if (v != NIL) {
        t[u].to[c] = v;
        if (u != root)
          t[v].link = t[t[u].link].to[c];
        else
          t[v].link = root;
        q.push(v);
      } else {
        t[u].to[c] = t[t[u].link].to[c];
      }
    }
  }
}
int go(int, char);
int get_link(int v) {
  if (t[v].link == NIL) {
    if (v == root or t[v].p == root)
      t[v].link = root;
    else
      t[v].link = go(get_link(t[v].p), t[v].pch);
  }
  return t[v].link;
}
int go(int v, char ch) {
  int c = ch - 'a';
  if (t[v].to[c] == NIL) {
    if (t[v].kid[c] != NIL)
      t[v].to[c] = t[v].kid[c];
    else
      t[v].to[c] = (v == root) ? root : go(get_link(v), ch);
  }
  return t[v].to[c];
}
string label(int v) {
  string ret = "";
  while (v != root) {
    ret += t[v].pch;
    v = t[v].p;
  }
  ret += "$";
  reverse((ret).begin(), (ret).end());
  return ret;
}
void fix_val() {
  queue<int> q;
  q.push(root);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < A; ++i) {
      if (t[u].kid[i] != NIL) {
        int v = t[u].kid[i];
        t[v].val += t[get_link(v)].val;
        q.push(v);
      }
    }
  }
}
};  // namespace AhoCorasick
struct Mat {
  int row, col;
  long long v[207][207];
  Mat(int r = 0, int c = 0) {
    row = r, col = c;
    memset(v, 0, sizeof v);
  }
  Mat operator*(const Mat &p) const {
    assert(col == p.row);
    Mat ret(row, p.col);
    for (int i = 0; i < ret.row; ++i) {
      for (int j = 0; j < ret.col; ++j) {
        ret.v[i][j] = -1;
        for (int k = 0; k < col; ++k) {
          if (v[i][k] != -1 and p.v[k][j] != -1) {
            ret.v[i][j] = max(ret.v[i][j], v[i][k] + p.v[k][j]);
          }
        }
      }
    }
    return ret;
  }
  Mat power(long long p) {
    assert(row == col);
    Mat base = *this;
    Mat ret(row, col);
    memset(ret.v, -1, sizeof ret.v);
    for (int i = 0; i < row; ++i) ret.v[i][i] = 0;
    while (p > 0) {
      if (p & 1) ret = ret * base;
      base = base * base;
      p >>= 1;
    }
    return ret;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, l;
  cin >> n >> l;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<string> s(n);
  for (int i = 0; i < n; ++i) cin >> s[i];
  for (int i = 0; i < n; ++i) {
    AhoCorasick::add_string(s[i], a[i]);
  }
  int tot = AhoCorasick::t.size();
  AhoCorasick::damnation();
  Mat del(tot, tot);
  memset(del.v, -1, sizeof del.v);
  for (int u = 0; u < tot; ++u) {
    for (char c = 'a'; c <= 'z'; ++c) {
      int v = AhoCorasick::go(u, c);
      del.v[v][u] = AhoCorasick::t[v].val;
    }
  }
  del = del.power(l);
  long long res = 0;
  for (int i = 0; i < tot; ++i) res = max(res, del.v[i][0]);
  cout << res << "\n";
  return 0;
}
