#include <bits/stdc++.h>
using namespace std;
const int maxn = 222;
int sz = 0;
struct node {
  node() {}
  node(int parent, int edge) : parent(parent), edge(edge) {
    child.assign(26, -1);
    go.assign(26, -1);
  }
  vector<int> child;
  vector<int> go;
  int parent;
  int edge;
  int cost = 0;
  int link = -1;
  long long sumCost = -1;
} nodes[maxn];
void add(const string& s, int cost) {
  int cur = 0;
  for (int i = 0; i < s.length(); i++) {
    if (nodes[cur].child[s[i] - 'a'] != -1) {
      cur = nodes[cur].child[s[i] - 'a'];
    } else {
      nodes[sz] = node(cur, s[i] - 'a');
      nodes[cur].child[s[i] - 'a'] = sz;
      cur = sz++;
    }
  }
  nodes[cur].cost += cost;
}
int get(int state, int edge);
int getPrev(int state) {
  if (nodes[state].link != -1) {
    return nodes[state].link;
  } else {
    if (state == 0 || nodes[state].parent == 0) {
      return 0;
    }
  }
  return nodes[state].link =
             get(getPrev(nodes[state].parent), nodes[state].edge);
}
int get(int state, int edge) {
  if (nodes[state].go[edge] != -1) {
    return nodes[state].go[edge];
  }
  int res;
  if (nodes[state].child[edge] != -1) {
    res = nodes[state].child[edge];
  } else {
    int prevState = getPrev(state);
    res = state == 0 ? 0 : get(prevState, edge);
  }
  nodes[state].go[edge] = res;
  return res;
}
long long getSumCost(int state) {
  if (nodes[state].sumCost != -1) {
    return nodes[state].sumCost;
  }
  return nodes[state].sumCost =
             (state == 0 ? 0 : getSumCost(getPrev(state)) + nodes[state].cost);
}
vector<vector<long long> > mult(vector<vector<long long> > a,
                                vector<vector<long long> > b) {
  vector<vector<long long> > c(a.size());
  for (int i = 0; i < a.size(); i++) {
    c[i] = vector<long long>(b[0].size(), -1);
    for (int j = 0; j < b[0].size(); j++) {
      for (int k = 0; k < b.size(); k++) {
        if (a[i][k] != -1 && b[k][j] != -1) {
          c[i][j] = max(c[i][j], a[i][k] + b[k][j]);
        }
      }
    }
  }
  return c;
}
vector<vector<long long> > bp(vector<vector<long long> > a, long long b) {
  if (b == 1) {
    return a;
  } else if (b % 2 == 0) {
    return bp(mult(a, a), b / 2);
  } else {
    return mult(a, bp(mult(a, a), b / 2));
  }
}
int main() {
  nodes[sz++] = node(0, 0);
  long long n, l;
  cin >> n >> l;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    add(s, a[i]);
  }
  vector<vector<long long> > b(sz);
  for (int state = 0; state < sz; state++) {
    b[state] = vector<long long>(sz, -1);
    for (int i = 0; i < 26; i++) {
      int nextState = get(state, i);
      b[state][nextState] = max(b[state][nextState], getSumCost(nextState));
    }
  }
  vector<long long> start(sz, -1);
  start[0] = 0;
  vector<vector<long long> > cur = {start};
  cur = mult(cur, bp(b, l));
  long long ans = 0;
  for (int i = 0; i < sz; i++) {
    ans = max(ans, cur[0][i]);
  }
  cout << ans;
  return 0;
}
