#include <bits/stdc++.h>
using namespace std;
constexpr size_t kStorageSize{201};
constexpr size_t kAlphabet{26};
int sz = 1;
struct Tree {
  int parentIndex{0};
  int prevChar{0};
  unsigned long long ownTerminal{0};
  unsigned long long terminal{0};
  int children[kAlphabet];
};
Tree storage[kStorageSize];
int l[kStorageSize];
vector<int> revl[kStorageSize];
int g[kStorageSize][kAlphabet];
void init() {
  memset(l, -1, sizeof(l));
  memset(storage[0].children, -1, sizeof(storage[0].children));
  for (int i = 0; i < kStorageSize; ++i) memset(g[i], -1, sizeof(g[i]));
}
int go(int v, char c);
int link(int v);
int link(int v) {
  if (l[v] != -1) return l[v];
  if (storage[v].parentIndex == 0) return l[v] = storage[v].parentIndex;
  l[v] = go(link(storage[v].parentIndex), storage[v].prevChar);
  revl[l[v]].push_back(v);
  return l[v];
}
int go(int v, char c) {
  if (g[v][c - 'a'] != -1) return g[v][c - 'a'];
  if (storage[v].children[c - 'a'] != -1)
    return g[v][c - 'a'] = storage[v].children[c - 'a'];
  if (v == 0) return g[v][c - 'a'] = 0;
  return g[v][c - 'a'] = go(link(v), c);
}
void add(const string &s, unsigned long long cost) {
  int v = 0;
  for (const auto &c : s) {
    if (storage[v].children[c - 'a'] == -1) {
      storage[v].children[c - 'a'] = sz;
      storage[sz].parentIndex = v;
      storage[sz].prevChar = c;
      memset(storage[sz].children, -1, sizeof(storage[sz].children));
      ++sz;
    }
    v = storage[v].children[c - 'a'];
  }
  storage[v].ownTerminal += cost;
}
void handleLinks() {
  for (int v = 0; v < sz; ++v) link(v);
  for (int v = 0; v < sz; ++v) {
    if (storage[v].ownTerminal == 0) continue;
    queue<int> q;
    q.push(v);
    unsigned long long val = storage[v].ownTerminal;
    storage[v].ownTerminal -= val;
    while (!q.empty()) {
      auto from = q.front();
      q.pop();
      storage[from].terminal += val;
      for (const auto &it : revl[from]) q.push(it);
    }
  }
}
int n;
unsigned long long len;
array<array<pair<bool, unsigned long long>, kStorageSize>, kStorageSize> m;
array<array<pair<bool, unsigned long long>, kStorageSize>, kStorageSize>
multiply(const array<array<pair<bool, unsigned long long>, kStorageSize>,
                     kStorageSize> &lhs,
         const array<array<pair<bool, unsigned long long>, kStorageSize>,
                     kStorageSize> &rhs) {
  array<array<pair<bool, unsigned long long>, kStorageSize>, kStorageSize>
      res{};
  for (int i = 0; i < sz; ++i)
    for (int j = 0; j < sz; ++j)
      for (int k = 0; k < sz; ++k) {
        if (!lhs[i][k].first || !rhs[k][j].first) continue;
        res[i][j].first = true;
        res[i][j].second =
            max(res[i][j].second, lhs[i][k].second + rhs[k][j].second);
      }
  return res;
}
array<array<pair<bool, unsigned long long>, kStorageSize>, kStorageSize> binpow(
    const array<array<pair<bool, unsigned long long>, kStorageSize>,
                kStorageSize> &m,
    unsigned long long poww) {
  if (poww == 0) {
    array<array<pair<bool, unsigned long long>, kStorageSize>, kStorageSize>
        res{};
    for (int v = 0; v < sz; ++v) res[v][v].first = true;
    return res;
  }
  if (poww % 2 == 0) return binpow(multiply(m, m), poww / 2);
  return multiply(m, binpow(m, poww - 1));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  init();
  cin >> n >> len;
  {
    vector<unsigned long long> tmp;
    for (int i = 0; i < n; ++i) {
      unsigned long long temp;
      cin >> temp;
      tmp.push_back(temp);
    }
    string s;
    for (int i = 0; i < n; ++i) {
      cin >> s;
      add(s, tmp[i]);
    }
  }
  handleLinks();
  for (int v = 0; v < sz; ++v)
    for (char c = 'a'; c <= 'z'; ++c) {
      m[v][go(v, c)].first = true;
      m[v][go(v, c)].second =
          max(m[v][go(v, c)].second, storage[go(v, c)].terminal);
    }
  array<array<pair<bool, unsigned long long>, kStorageSize>, kStorageSize>
      resM = binpow(m, len);
  unsigned long long res = 0;
  for (int v = 0; v < sz; ++v) res = max(res, resM[0][v].second);
  cout << res << endl;
  return 0;
}
