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 bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x) == 1; }
inline bool SR(char *s) { return scanf("%s", s) == 1; }
inline bool RI() { return true; }
template <typename I, typename... T>
inline bool RI(I &x, T &...tail) {
  return SR(x) && RI(tail...);
}
inline void SP(const int x) { printf("%d", x); }
inline void SP(const long long x) { printf("%lld", x); }
inline void SP(const double x) { printf("%.16lf", x); }
inline void SP(const char *s) { printf("%s", s); }
inline void PL() { puts(""); }
template <typename I, typename... T>
inline void PL(const I x, const T... tail) {
  SP(x);
  if (sizeof...(tail)) putchar(' ');
  PL(tail...);
}
template <typename I>
void _DOING(const char *s, I &&x) {
  cerr << s << " = " << x << endl;
}
template <typename I, typename... T>
void _DOING(const char *s, I &&x, T &&...tail) {
  int c = 0;
  while (*s != ',' || c != 0) {
    if (*s == '(' || *s == '[' || *s == '{') c++;
    if (*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1, tail...);
}
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) & 0x7fffffff;
}
const int MAX_N = 200 + 10;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
struct Matrix {
  long long a[MAX_N][MAX_N];
  int r, c;
  Matrix(int _r = 0, int _c = 0) : r(_r), c(_c) {
    for (int i = 0; i < int(_r); i++) {
      for (int j = 0; j < int(_c); j++)
        if (i == j)
          a[i][j] = 0;
        else
          a[i][j] = -INF;
    }
  }
};
inline Matrix operator*(const Matrix &a, const Matrix &b) {
  Matrix c(a.r, b.c);
  for (int k = 0; k < int(a.c); k++) {
    for (int i = 0; i < int(a.r); i++) {
      for (int j = 0; j < int(b.c); j++)
        c.a[i][j] = max(c.a[i][j], a.a[i][k] + b.a[k][j]);
    }
  }
  return c;
}
inline Matrix power(Matrix a, long long n) {
  Matrix x(a.r, a.c);
  while (n) {
    if (n & 1) x = x * a;
    a = a * a;
    n >>= 1;
  }
  return x;
}
int id_cnt;
struct Node {
  Node *nxt[26], *fail;
  int id;
  long long val;
  Node() {
    memset(nxt, (0), sizeof(nxt));
    ;
    fail = NULL;
    id = id_cnt++;
    val = 0;
  }
};
Node *root = NULL;
inline void insert(char *s, long long val) {
  Node *p = root;
  while (*s) {
    if (!p->nxt[*s - 'a']) p->nxt[*s - 'a'] = new Node();
    p = p->nxt[*s - 'a'], s++;
  }
  p->val += val;
}
inline void build_ac() {
  queue<Node *> que;
  que.push(root);
  while (!que.empty()) {
    Node *u = que.front();
    que.pop();
    for (int i = 0; i < int(26); i++) {
      if (u->nxt[i]) {
        if (u == root)
          u->nxt[i]->fail = root;
        else {
          Node *p = u->fail;
          while (p) {
            if (!p->nxt[i])
              p = p->fail;
            else
              break;
          }
          if (p)
            u->nxt[i]->fail = p->nxt[i], u->nxt[i]->val += p->nxt[i]->val;
          else
            u->nxt[i]->fail = root;
        }
        que.push(u->nxt[i]);
      }
    }
  }
}
Matrix mat;
inline void build_mat() {
  queue<Node *> que;
  que.push(root);
  mat = Matrix(id_cnt, id_cnt);
  while (!que.empty()) {
    Node *u = que.front();
    que.pop();
    for (int i = 0; i < int(26); i++) {
      if (u->nxt[i]) {
        mat.a[u->id][u->nxt[i]->id] = u->nxt[i]->val;
        que.push(u->nxt[i]);
      } else {
        Node *p = u->fail;
        while (p) {
          if (!p->nxt[i])
            p = p->fail;
          else
            break;
        }
        if (p) mat.a[u->id][p->nxt[i]->id] = p->nxt[i]->val;
      }
    }
  }
}
long long a[MAX_N];
char str[MAX_N];
int main() {
  root = new Node();
  int n;
  long long l;
  RI(n, l);
  for (int i = 0; i < int(n); i++) RI(a[i]);
  for (int i = 0; i < int(n); i++) {
    RI(str);
    insert(str, a[i]);
  }
  build_ac();
  build_mat();
  Matrix x = power(mat, l);
  long long ans = 0;
  for (int i = 0; i < int(id_cnt); i++) ans = max(ans, x.a[0][i]);
  PL(ans);
  return 0;
}