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 std::abs;
using std::bitset;
using std::cerr;
using std::cin;
using std::copy;
using std::cout;
using std::deque;
using std::endl;
using std::fill;
using std::fixed;
using std::greater;
using std::iota;
using std::istream;
using std::lower_bound;
using std::make_pair;
using std::make_tuple;
using std::map;
using std::max;
using std::max_element;
using std::min;
using std::min_element;
using std::multiset;
using std::next_permutation;
using std::nth_element;
using std::ostream;
using std::pair;
using std::priority_queue;
using std::queue;
using std::reverse;
using std::rotate;
using std::set;
using std::sort;
using std::string;
using std::swap;
using std::tie;
using std::tuple;
using std::unique;
using std::unordered_map;
using std::unordered_set;
using std::upper_bound;
using std::vector;
long long rnd(long long x, long long y) {
  static auto gen = std::bind(std::uniform_int_distribution<long long>(),
                              std::mt19937(960172));
  return gen() % (y - x + 1) + x;
}
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
template <typename T>
T sqr(T const& a) {
  return a * a;
}
int const INF = 100 + (int)1e9;
long long const INFL = 100 + (long long)1e18;
long double const PI = 3.1415926535897932384626433832795028;
int const N = 211;
int const A = 26;
int next[N][A];
int link[N];
int go[N][A];
int prev[N];
int back[N];
int leaf[N];
int sz;
int getNode(int pr, int edge) {
  std::fill(next[sz], next[sz] + A, -1);
  link[sz] = -1;
  std::fill(go[sz], go[sz] + A, -1);
  prev[sz] = pr;
  back[sz] = edge;
  leaf[sz] = 0;
  return sz++;
}
int getGo(int, int);
int getLink(int v) {
  if (link[v] == -1) {
    if (v == 0 || prev[v] == 0) {
      link[v] = 0;
    } else {
      link[v] = getGo(getLink(prev[v]), back[v]);
    }
  }
  return link[v];
}
int getGo(int v, int x) {
  if (go[v][x] == -1) {
    if (next[v][x] != -1) {
      go[v][x] = next[v][x];
    } else if (v == 0) {
      go[v][x] = v;
    } else {
      go[v][x] = getGo(getLink(v), x);
    }
  }
  return go[v][x];
}
void mul(long long a[N][N], long long b[N][N], long long c[N][N]) {
  static long long t[N][N];
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      long long cur = -INFL;
      for (int k = 0; k < N; ++k) {
        cur = max(cur, a[i][k] + b[k][j]);
      }
      t[i][j] = cur;
    }
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      c[i][j] = t[i][j];
    }
  }
}
int a[N];
void solve() {
  int n;
  long long L;
  scanf(
      "%d"
      "%lld",
      &n, &L);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  static char buf[N];
  gets(buf);
  getNode(0, 0);
  for (int i = 0; i < n; ++i) {
    gets(buf);
    int v = 0;
    for (int j = 0; buf[j]; ++j) {
      int x = buf[j] - 'a';
      if (next[v][x] == -1) {
        next[v][x] = getNode(v, x);
      }
      v = next[v][x];
    }
    leaf[v] += a[i];
  }
  {
    vector<int> q = {0};
    for (int head = 0; head < (int)q.size(); ++head) {
      int v = q[head];
      leaf[v] += leaf[getLink(v)];
      for (int x = 0; x < A; ++x) {
        int to = next[v][x];
        if (to >= 0) {
          q.push_back(to);
        }
      }
    }
  }
  static long long mat[N][N];
  for (int i = 0; i < N; ++i) {
    fill(mat[i], mat[i] + N, -INFL);
  }
  for (int from = 0; from < sz; ++from) {
    for (int x = 0; x < A; ++x) {
      int to = getGo(from, x);
      if (mat[to][from] == -INFL) {
        mat[to][from] = 0;
      }
      mat[to][from] += leaf[to];
    }
  }
  static long long dp[N];
  fill(dp, dp + N, -INFL);
  dp[0] = 0;
  for (long long l = L; l > 0; l /= 2) {
    if (l % 2 == 1) {
      static long long dp1[N];
      for (int v = 0; v < N; ++v) {
        long long cur = -INFL;
        for (int u = 0; u < N; ++u) {
          cur = max(cur, dp[u] + mat[v][u]);
        }
        dp1[v] = cur;
      }
      for (int i = 0; i < N; ++i) {
        dp[i] = dp1[i];
      }
    }
    mul(mat, mat, mat);
  }
  cout << *max_element(dp, dp + N) << endl;
}
int main() {
  cout.precision(15);
  cout << fixed;
  cerr.precision(6);
  cerr << fixed;
  solve();
}