#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long INF = 1ll << 60;
const int MAXN = 201;
int m;
struct matrix {
  long long a[MAXN][MAXN];
};
matrix mul(matrix a, matrix b) {
  matrix c;
  for (int i = 0; i <= m; i++) {
    for (int j = i + 1; j <= m; j++) {
      swap(b.a[i][j], b.a[j][i]);
    }
  }
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= m; j++) {
      c.a[i][j] = -INF;
      for (int l = 0; l <= m; l++) {
        c.a[i][j] = max(c.a[i][j], a.a[i][l] + b.a[j][l]);
      }
    }
  }
  return c;
}
matrix st;
matrix cur;
string s[MAXN];
int w[MAXN];
int id[MAXN];
int a[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  long long ln;
  cin >> n >> ln;
  for (int i = 0; i < n; i++) cin >> a[i];
  m = 0;
  w[0] = 0, id[0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < s[i].length(); j++) {
      m++;
      w[m] = i;
      id[m] = j + 1;
    }
  }
  for (int j = 0; j <= m; j++) {
    long long vl = 0;
    for (int i = 0; i <= m; i++) {
      if (s[i].length() > id[j]) continue;
      bool ok = true;
      for (int l = 0; l < s[i].length(); l++) {
        ok &= (s[i][l] == s[w[j]][id[j] - s[i].length() + l]);
      }
      if (ok) vl += a[i];
    }
    for (int i = 0; i <= m; i++) {
      st.a[i][j] = -INF;
      if (j == 0) continue;
      if (id[j] > id[i] + 1) continue;
      bool ok = true;
      for (int l = 0; l < id[j] - 1; l++) {
        ok &= (s[w[j]][l] == s[w[i]][id[i] - (id[j] - 1) + l]);
      }
      if (ok) st.a[i][j] = vl;
    }
  }
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= m; j++) {
      cur.a[i][j] = -INF;
    }
    cur.a[i][i] = 0;
  }
  for (int i = 47; i >= 0; i--) {
    cur = mul(cur, cur);
    if ((1ll << i) & ln) cur = mul(cur, st);
  }
  long long ans = -INF;
  for (int i = 0; i <= m; i++) {
    ans = max(ans, cur.a[0][i]);
  }
  cout << ans << endl;
  return 0;
}
