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;
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return (POW(B, P / 2) * POW(B, P / 2));
}
template <typename T>
inline T Gcd(T a, T b) {
  if (a < 0) return Gcd(-a, b);
  if (b < 0) return Gcd(a, -b);
  return (b == 0) ? a : Gcd(b, a % b);
}
template <typename T>
inline T Lcm(T a, T b) {
  if (a < 0) return Lcm(-a, b);
  if (b < 0) return Lcm(a, -b);
  return a * (b / Gcd(a, b));
}
long long Bigmod(long long base, long long power, long long MOD) {
  long long ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
template <typename T>
long long int isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
long long ModInverse(long long number, long long MOD) {
  return Bigmod(number, MOD - 2, MOD);
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
int toInt(string s) {
  int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
struct Matrix {
  long long int ar[302][302];
};
int N;
Matrix MUL(Matrix a, Matrix b) {
  Matrix ans;
  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      ans.ar[i][j] = -2000000000000000000LL;
      for (int k = 1; k < N; k++) {
        ans.ar[i][j] = max(ans.ar[i][j], a.ar[i][k] + b.ar[k][j]);
      }
    }
  }
  return ans;
}
Matrix Big_Mod(Matrix a, long long int n) {
  Matrix ans = a;
  n--;
  while (n) {
    if (n & 1) {
      ans = MUL(ans, a);
    }
    a = MUL(a, a);
    n /= 2;
  }
  return ans;
}
struct Nd {
  int Fl, Fq, E[26];
  Nd() {
    Fl = Fq = 0;
    memset(E, 0, sizeof(E));
  }
};
Nd Tree[2007];
int avail, dp[2007];
void In(string s, int vl) {
  int pos = 1;
  for (int i = 0; i < s.size(); i++) {
    if (Tree[pos].E[s[i] - 'a'] == 0) {
      Tree[pos].E[s[i] - 'a'] = ++avail;
      Tree[avail] = Nd();
    }
    pos = Tree[pos].E[s[i] - 'a'];
  }
  dp[pos] += vl;
  return;
}
void Fail() {
  queue<int> q;
  q.push(1);
  for (int i = 0; i < 26; i++) {
    Tree[0].E[i] = 1;
  }
  Tree[1].Fl = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < 26; i++) {
      if (Tree[u].E[i]) {
        Tree[Tree[u].E[i]].Fl = Tree[Tree[u].Fl].E[i];
        q.push(Tree[u].E[i]);
      } else {
        Tree[u].E[i] = Tree[Tree[u].Fl].E[i];
      }
    }
  }
  return;
}
vector<int> A[2007];
void bal(int u, int vl) {
  dp[u] += vl;
  vl = dp[u];
  for (int i = 0; i < A[u].size(); i++) {
    int v = A[u][i];
    bal(v, vl);
  }
}
int a[2007];
void Prnt(Matrix a) {
  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      cout << a.ar[i][j] << " ";
    }
    printf("\n");
  }
}
int main() {
  Tree[1] = Nd();
  avail = 1;
  int n;
  n = in<int>();
  long long int m;
  m = in<long long int>();
  for (int i = 0; i < n; i++) a[i] = in<int>();
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    In(s, a[i]);
  }
  Fail();
  for (int i = 1; i <= avail; i++) {
    int nx = Tree[i].Fl;
    A[nx].push_back(i);
  }
  bal(0, 0);
  N = avail + 1;
  Matrix base;
  for (int i = 1; i < avail + 1; i++) {
    for (int j = 1; j < avail + 1; j++) {
      base.ar[i][j] = -2000000000000000000LL;
    }
  }
  for (int i = 1; i <= avail; i++) {
    int st = i;
    for (int j = 0; j < 26; j++) {
      int ed = Tree[i].E[j];
      base.ar[ed][st] = ((base.ar[ed][st] > dp[ed]) ? base.ar[ed][st] : dp[ed]);
    }
  }
  base = Big_Mod(base, m);
  long long int ans = 0;
  for (int i = 1; i < avail + 1; i++) {
    ans = max(ans, base.ar[i][1]);
  }
  cout << ans << endl;
  return 0;
}