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;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
struct AhoCorasick {
  enum { alpha = 26, first = 'a' };
  struct Node {
    long long back, next[alpha], start = -1, end = -1;
    long long nmatches = 0;
    Node(long long v) { memset(next, v, sizeof(next)); }
  };
  long long maxi = 0;
  vector<Node> N;
  vector<long long> backp;
  void insert(string& s, long long j, long long val) {
    assert(!s.empty());
    long long n = 0;
    for (auto& c : s) {
      maxi = (maxi < n ? n : maxi);
      long long& m = N[n].next[c - first];
      if (m == -1) {
        n = m = (long long)N.size();
        N.emplace_back(-1);
      } else
        n = m;
      maxi = (maxi < n ? n : maxi);
    }
    if (N[n].end == -1) N[n].start = j;
    backp.push_back(N[n].end);
    N[n].end = j;
    maxi = (maxi < n ? n : maxi);
    N[n].nmatches += val;
  }
  AhoCorasick(vector<pair<string, long long>>& pat) {
    N.emplace_back(-1);
    for (long long i = 0; i < ((long long)pat.size()); ++i)
      insert(pat[i].first, i, pat[i].second);
    N[0].back = (long long)N.size();
    N.emplace_back(0);
    queue<long long> q;
    for (q.push(0); !q.empty(); q.pop()) {
      long long n = q.front(), prev = N[n].back;
      for (long long i = 0; i < (alpha); ++i) {
        long long &ed = N[n].next[i], y = N[prev].next[i];
        if (ed == -1)
          ed = y;
        else {
          N[ed].back = y;
          (N[ed].end == -1 ? N[ed].end : backp[N[ed].start]) = N[y].end;
          N[ed].nmatches += N[y].nmatches;
          q.push(ed);
        }
      }
    }
  }
  long long cost(string word) {
    long long n = 0;
    vector<long long> res;
    long long count = 0;
    for (auto& c : word) {
      n = N[n].next[c - first];
      res.push_back(N[n].end);
      count += N[n].nmatches;
    }
    return count;
  }
};
const long long inf = (long long)1e18;
struct matrix {
  long long n, m;
  vector<vector<long long>> mat;
  matrix() {}
  matrix(long long l, long long c) {
    n = l;
    m = c;
    mat.resize(n, vector<long long>(m, -inf));
  }
  void nsize(long long l, long long c) {
    n = l;
    m = c;
    mat.resize(n, vector<long long>(m, -inf));
  }
};
matrix operator*(const matrix& A, const matrix& B) {
  matrix ret(A.n, B.m);
  for (long long i = 0; i < A.n; i++)
    for (long long j = 0; j < B.m; j++)
      for (long long k = 0; k < A.m; k++) {
        ret.mat[i][j] = max(A.mat[i][k] + B.mat[k][j], ret.mat[i][j]);
      }
  return ret;
}
matrix def;
matrix expo(matrix a, long long b) {
  if (b == 0) return def;
  if (b == 1) {
    return a;
  }
  matrix now = expo(a, b / 2);
  if (b & 1) {
    return a * now * now;
  } else
    return now * now;
}
const long long N = 210;
long long a[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  long long l;
  cin >> n >> l;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<pair<string, long long>> vec;
  for (long long i = 1; i <= n; i++) {
    string s;
    cin >> s;
    vec.push_back(pair<string, long long>(s, a[i]));
  }
  AhoCorasick aho(vec);
  long long maxi = aho.maxi;
  def = matrix(maxi + 1, maxi + 1);
  matrix mat(maxi + 1, maxi + 1);
  for (long long i = 0; i <= maxi; i++) {
    for (long long j = 0; j <= maxi; j++) {
      mat.mat[i][j] = -inf;
      def.mat[i][j] = (i == j ? 1 : 0);
    }
  }
  for (long long i = 0; i <= maxi; i++) {
    for (long long j = 0; j < 26; j++) {
      long long id = aho.N[i].next[j];
      if (id != -1) mat.mat[i][id] = aho.N[id].nmatches;
    }
  }
  mat = expo(mat, l);
  long long res = 0;
  for (long long i = 0; i <= maxi; i++) {
    res = max(res, mat.mat[0][i]);
  }
  cout << res << "\n";
}