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 maxnode = 20010;
const int sigma_size = 26;
long long idx[256];
void init_idx() {
  for (long long i = 'a'; i <= 'z'; i++) idx[i] = i - 'a';
}
struct AhoCorasickAutomata {
  long long ch[maxnode][sigma_size];
  long long val[maxnode], f[maxnode], sum[maxnode];
  long long sz;
  void init() {
    sz = 1;
    memset(ch[0], 0, sizeof(ch[0]));
  }
  void insert(char* s, long long v) {
    long long u = 0, n = strlen(s);
    for (long long i = 0; i < n; i++) {
      long long c = idx[s[i]];
      if (!ch[u][c]) {
        val[sz] = sum[sz] = 0;
        memset(ch[sz], 0, sizeof(ch[sz]));
        ch[u][c] = sz++;
      }
      u = ch[u][c];
    }
    val[u] += v;
    sum[u] = val[u];
  }
  void getFail() {
    queue<long long> q;
    f[0] = 0;
    for (long long c = 0; c < sigma_size; c++) {
      long long u = ch[0][c];
      if (u) {
        f[u] = 0;
        q.push(u);
      }
    }
    while (!q.empty()) {
      long long r = q.front();
      q.pop();
      for (long long c = 0; c < sigma_size; c++) {
        long long u = ch[r][c];
        if (!u) {
          ch[r][c] = ch[f[r]][c];
          continue;
        }
        q.push(u);
        long long v = f[r];
        while (v && !ch[v][c]) v = f[v];
        f[u] = ch[v][c];
        sum[u] = val[u] + sum[f[u]];
      }
    }
  }
} ac;
struct Matrix {
  long long n;
  long long a[210][210];
  Matrix operator*(Matrix& rhs) {
    Matrix ret;
    ret.n = n;
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < n; j++) {
        ret.a[i][j] = -1;
        for (long long k = 0; k < n; k++)
          if (a[i][k] != -1 && rhs.a[k][j] != -1)
            ret.a[i][j] = max(ret.a[i][j], a[i][k] + rhs.a[k][j]);
      }
    return ret;
  }
};
Matrix gen_matrix() {
  Matrix ret;
  ret.n = ac.sz;
  memset(ret.a, -1, sizeof(ret.a));
  for (long long i = 0; i < ret.n; i++) {
    for (long long c = 0; c < sigma_size; c++) {
      long long j = ac.ch[i][c];
      ret.a[i][j] = max(ret.a[i][j], ac.sum[j]);
    }
  }
  return ret;
}
Matrix q_pow(Matrix A, long long k) {
  Matrix ret;
  ret.n = A.n;
  bool fir = true;
  while (k) {
    if (k & 1ll) {
      if (fir)
        ret = A;
      else
        ret = ret * A;
      fir = false;
    }
    k >>= 1ll;
    A = A * A;
  }
  return ret;
}
Matrix res;
long long v[210];
char s[210];
int main() {
  init_idx();
  long long num, k;
  while (~scanf("%lld%lld", &num, &k)) {
    ac.init();
    for (long long i = 0; i < num; i++) scanf("%lld", &v[i]);
    for (long long i = 0; i < num; i++) {
      scanf("%s", s);
      ac.insert(s, v[i]);
    }
    ac.getFail();
    res = gen_matrix();
    res = q_pow(res, k);
    long long ans = 0;
    for (long long i = 0; i < res.n; i++) ans = max(ans, res.a[0][i]);
    printf("%lld\n", ans);
  }
  return 0;
}