Problem: Barney was hanging out with Nora for a while and now he thinks he may have feelings for her. Barney wants to send her a cheesy text message and wants to make her as happy as possible.

<image>

Initially, happiness level of Nora is 0. Nora loves some pickup lines like "I'm falling for you" and stuff. Totally, she knows n pickup lines, each consisting only of lowercase English letters, also some of them may be equal (in writing, but different in pronouncing or meaning though). Every time Nora sees i-th pickup line as a consecutive subsequence of Barney's text message her happiness level increases by ai. These substrings may overlap, for example, Nora will see the pickup line aa twice and the pickup line ab once in text message aaab.

Due to texting app limits, Barney's text may have up to l characters.

Barney asked you to help him make Nora as much happy as possible, it's gonna be legen...

Input

The first line of input contains two integers n and l (1 ≤ n ≤ 200, 1 ≤ l ≤ 1014) — the number of pickup lines and the maximum length of Barney's text.

The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100), meaning that Nora's happiness level increases by ai after every time seeing i-th pickup line.

The next n lines contain the pickup lines. i-th of them contains a single string si consisting of only English lowercase letter. Summary length of all pickup lines does not exceed 200.

All strings are not empty.

Output

Print the only integer — the maximum possible value of Nora's happiness level after reading Barney's text.

Examples

Input

3 6
3 2 1
heart
earth
art


Output

6


Input

3 6
3 2 8
heart
earth
art


Output

16

Note

An optimal answer for the first sample case is hearth containing each pickup line exactly once.

An optimal answer for the second sample case is artart.

Solution (in CPP):

Solution:
#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;
}