#include <bits/stdc++.h>
using namespace std;
const long long INF = 2LL * (long long)(1e18);
const int N = 222;
int sz;
int link2203[N], pv[N], pc[N], a[N], ver[N], q[N];
char buf[N];
int next2203[N][26], go[N][26], sum[N];
long long dp[N][N], tmp[N][N], g[N][N];
inline void update(long long a[N][N], long long b[N][N]) {
  for (int i = 0; i < sz; i++) {
    for (int j = 0; j < sz; j++) {
      tmp[i][j] = -INF;
      for (int z = 0; z < sz; z++) {
        if (a[i][z] == -INF || b[z][j] == -INF) {
          continue;
        }
        tmp[i][j] = max(tmp[i][j], a[i][z] + b[z][j]);
      }
    }
  }
  for (int i = 0; i < sz; i++) {
    for (int j = 0; j < sz; j++) {
      a[i][j] = tmp[i][j];
    }
  }
}
inline void findans(long long n) {
  if (n == 1) {
    for (int i = 0; i < sz; i++) {
      for (int j = 0; j < sz; j++) {
        dp[i][j] = g[i][j];
      }
    }
    return;
  }
  if (n % 2 == 0) {
    findans(n / 2);
    update(dp, dp);
  } else {
    findans(n - 1);
    update(dp, g);
  }
}
int main() {
  int n;
  long long L;
  cin >> n >> L;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sz = 1;
  for (int i = 0; i < 26; i++) {
    next2203[0][i] = -1;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", buf);
    int len = strlen(buf), cur = 0;
    for (int j = 0; j < len; j++) {
      int c = buf[j] - 'a';
      if (next2203[cur][c] == -1) {
        for (int z = 0; z < 26; z++) {
          next2203[sz][z] = -1;
        }
        pv[sz] = cur;
        pc[sz] = c;
        next2203[cur][c] = sz++;
      }
      cur = next2203[cur][c];
    }
    ver[i] = cur;
    sum[cur] += a[i];
  }
  int l = 0, r = 1;
  q[0] = 0;
  while (l < r) {
    int v = q[l++];
    if (v == 0 || pv[v] == 0) {
      link2203[v] = 0;
    } else {
      link2203[v] = go[link2203[pv[v]]][pc[v]];
    }
    if (v > 0) {
      sum[v] += sum[link2203[v]];
    }
    for (int i = 0; i < 26; i++) {
      if (next2203[v][i] != -1) {
        go[v][i] = next2203[v][i];
        q[r++] = next2203[v][i];
      } else {
        if (v == 0) {
          go[v][i] = 0;
        } else {
          go[v][i] = go[link2203[v]][i];
        }
      }
    }
  }
  for (int i = 0; i < sz; i++) {
    for (int j = 0; j < sz; j++) {
      g[i][j] = -INF;
    }
  }
  for (int i = 0; i < sz; i++) {
    for (int j = 0; j < 26; j++) {
      g[i][go[i][j]] = max(g[i][go[i][j]], 1LL * sum[go[i][j]]);
    }
  }
  findans(L);
  long long ans = -INF;
  for (int i = 0; i < sz; i++) {
    ans = max(ans, dp[0][i]);
  }
  cout << ans << endl;
  return 0;
}
