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 MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return a > val ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
struct matrix {
  static const int MAXN = 210;
  long long x[MAXN][MAXN];
  matrix() { memset(x, 0, sizeof(x)); }
  matrix unit() {
    matrix res;
    for (int i = 0; i < MAXN; i++) res.x[i][i] = 1;
    return res;
  }
  matrix operator*(matrix A) {
    matrix res;
    for (int i = (0); i < (MAXN); i++)
      for (int j = (0); j < (MAXN); j++) res.x[i][j] = -LINF;
    for (int i = 0; i < MAXN; i++)
      for (int k = 0; k < MAXN; k++)
        for (int j = 0; j < MAXN; j++) {
          if (x[i][k] != -LINF && A.x[k][j] != -LINF) {
            chkmax(res.x[i][j], x[i][k] + A.x[k][j]);
          }
        }
    return res;
  }
  matrix operator^(long long k) {
    if (!k) return unit();
    matrix res, tmp;
    for (int i = 0; i < MAXN; i++)
      for (int j = 0; j < MAXN; j++) {
        res.x[i][j] = tmp.x[i][j] = x[i][j];
      }
    k--;
    while (k) {
      if (k & 1) res = res * tmp;
      tmp = tmp * tmp;
      k >>= 1;
    }
    return res;
  }
};
const int MAXN = 100010;
const int MAXC = 26;
struct Node {
  Node* parent;
  Node* child[MAXC];
  Node* bfail;
  Node* gfail;
  int key, cost, sum;
  char val;
  Node() {
    bfail = 0;
    key = -1, cost = sum = 0;
  }
} node[MAXN];
Node* alloc = node;
Node* q[MAXN];
Node* root = alloc++;
Node* insert(Node* x, string s, int key, int cost) {
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - 'a';
    if (!x->child[c]) {
      x->child[c] = alloc++;
      x->child[c]->val = c;
      x->child[c]->parent = x;
    }
    x = x->child[c];
  }
  x->key = key;
  x->cost += cost;
  return x;
}
void pushlink(Node* root) {
  int b = 0, e = 0;
  q[e++] = root;
  while (b < e) {
    Node* x = q[b++];
    for (int i = 0; i < MAXC; i++) {
      if (x->child[i]) q[e++] = x->child[i];
    }
    if (x == root || x->parent == root) {
      x->bfail = root;
      x->gfail = 0;
    } else {
      x->bfail = x->parent->bfail;
      while (x->bfail != root && !x->bfail->child[x->val])
        x->bfail = x->bfail->bfail;
      if (x->bfail->child[x->val]) x->bfail = x->bfail->child[x->val];
      if (x->bfail->key != -1)
        x->gfail = x->bfail;
      else
        x->gfail = x->bfail->gfail;
    }
  }
}
const int maxn = 210;
int n;
long long l;
int a[maxn];
string s[maxn];
matrix A;
void upd(Node* x) {
  Node* tmp = x;
  while (1) {
    x->sum += tmp->cost;
    if (tmp == root) {
      break;
    }
    tmp = tmp->bfail;
  }
  for (int i = 0; i < MAXC; i++) {
    if (x->child[i]) {
      upd(x->child[i]);
    }
  }
}
void build(Node* x) {
  for (int i = (0); i < (MAXC); i++) {
    if (x->child[i]) {
      build(x->child[i]);
    }
  }
  Node* tmp = x;
  while (1) {
    for (int i = (0); i < (MAXC); i++) {
      Node* y = tmp->child[i];
      if (y) {
        int u = x - root;
        int v = y - root;
        A.x[u][v] = y->sum;
      }
    }
    if (tmp == root) {
      break;
    }
    tmp = tmp->bfail;
  }
}
void solve() {
  cin >> n >> l;
  for (int i = (0); i < (n); i++) cin >> a[i];
  for (int i = (0); i < (n); i++) {
    cin >> s[i];
    insert(root, s[i], i, a[i]);
  }
  for (int i = (0); i < (A.MAXN); i++)
    for (int j = (0); j < (A.MAXN); j++) A.x[i][j] = -LINF;
  pushlink(root);
  upd(root);
  build(root);
  A = A ^ l;
  long long ans = 0;
  for (int i = (0); i < (A.MAXN); i++) {
    chkmax(ans, A.x[0][i]);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}