#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
struct AhoCorasick {
  enum { alpha = 26, first = 'a' };
  struct Node {
    long long back, next[alpha], start = -1, end = -1;
    long long nmatches = 0;
    Node(long long v) { memset(next, v, sizeof(next)); }
  };
  long long maxi = 0;
  vector<Node> N;
  vector<long long> backp;
  void insert(string& s, long long j, long long val) {
    assert(!s.empty());
    long long n = 0;
    for (auto& c : s) {
      maxi = (maxi < n ? n : maxi);
      long long& m = N[n].next[c - first];
      if (m == -1) {
        n = m = (long long)N.size();
        N.emplace_back(-1);
      } else
        n = m;
      maxi = (maxi < n ? n : maxi);
    }
    if (N[n].end == -1) N[n].start = j;
    backp.push_back(N[n].end);
    N[n].end = j;
    maxi = (maxi < n ? n : maxi);
    N[n].nmatches += val;
  }
  AhoCorasick(vector<pair<string, long long>>& pat) {
    N.emplace_back(-1);
    for (long long i = 0; i < ((long long)pat.size()); ++i)
      insert(pat[i].first, i, pat[i].second);
    N[0].back = (long long)N.size();
    N.emplace_back(0);
    queue<long long> q;
    for (q.push(0); !q.empty(); q.pop()) {
      long long n = q.front(), prev = N[n].back;
      for (long long i = 0; i < (alpha); ++i) {
        long long &ed = N[n].next[i], y = N[prev].next[i];
        if (ed == -1)
          ed = y;
        else {
          N[ed].back = y;
          (N[ed].end == -1 ? N[ed].end : backp[N[ed].start]) = N[y].end;
          N[ed].nmatches += N[y].nmatches;
          q.push(ed);
        }
      }
    }
  }
  long long cost(string word) {
    long long n = 0;
    vector<long long> res;
    long long count = 0;
    for (auto& c : word) {
      n = N[n].next[c - first];
      res.push_back(N[n].end);
      count += N[n].nmatches;
    }
    return count;
  }
};
const long long inf = (long long)1e18;
struct matrix {
  long long n, m;
  vector<vector<long long>> mat;
  matrix() {}
  matrix(long long l, long long c) {
    n = l;
    m = c;
    mat.resize(n, vector<long long>(m, -inf));
  }
  void nsize(long long l, long long c) {
    n = l;
    m = c;
    mat.resize(n, vector<long long>(m, -inf));
  }
};
matrix operator*(const matrix& A, const matrix& B) {
  matrix ret(A.n, B.m);
  for (long long i = 0; i < A.n; i++)
    for (long long j = 0; j < B.m; j++)
      for (long long k = 0; k < A.m; k++) {
        ret.mat[i][j] = max(A.mat[i][k] + B.mat[k][j], ret.mat[i][j]);
      }
  return ret;
}
matrix def;
matrix expo(matrix a, long long b) {
  if (b == 0) return def;
  if (b == 1) {
    return a;
  }
  matrix now = expo(a, b / 2);
  if (b & 1) {
    return a * now * now;
  } else
    return now * now;
}
const long long N = 210;
long long a[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  long long l;
  cin >> n >> l;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<pair<string, long long>> vec;
  for (long long i = 1; i <= n; i++) {
    string s;
    cin >> s;
    vec.push_back(pair<string, long long>(s, a[i]));
  }
  AhoCorasick aho(vec);
  long long maxi = aho.maxi;
  def = matrix(maxi + 1, maxi + 1);
  matrix mat(maxi + 1, maxi + 1);
  for (long long i = 0; i <= maxi; i++) {
    for (long long j = 0; j <= maxi; j++) {
      mat.mat[i][j] = -inf;
      def.mat[i][j] = (i == j ? 1 : 0);
    }
  }
  for (long long i = 0; i <= maxi; i++) {
    for (long long j = 0; j < 26; j++) {
      long long id = aho.N[i].next[j];
      if (id != -1) mat.mat[i][id] = aho.N[id].nmatches;
    }
  }
  mat = expo(mat, l);
  long long res = 0;
  for (long long i = 0; i <= maxi; i++) {
    res = max(res, mat.mat[0][i]);
  }
  cout << res << "\n";
}
