#include <bits/stdc++.h>
using namespace std;
typedef struct trie {
  int id;
  int ok;
  int number;
  trie *next[26];
  trie *fail;
} trie;
trie *root;
long long ma[220][220] = {0};
int coun = 0;
trie *pp[220];
void insert(char *s, int p) {
  trie *tem = root;
  int t = (int)strlen(s);
  for (int i = 0; i < t; i++) {
    if (tem->next[s[i] - 'a'] == NULL) {
      trie *cur = (trie *)malloc(sizeof(trie));
      for (int i = 0; i < 26; i++) {
        cur->next[i] = NULL;
      }
      cur->id = coun;
      pp[coun] = cur;
      coun++;
      cur->ok = 0;
      cur->number = 0;
      tem->next[s[i] - 'a'] = cur;
    }
    tem = tem->next[s[i] - 'a'];
    if (i == t - 1) {
      tem->ok = 1;
      tem->number += p;
    }
  }
}
void makefail() {
  trie *front;
  queue<trie *> q;
  q.push(root);
  while (!q.empty()) {
    front = q.front();
    q.pop();
    for (int i = 0; i < 26; i++) {
      if (front->next[i] != NULL) {
        if (front == root) {
          front->next[i]->fail = root;
        } else {
          trie *temp = front;
          while (temp->fail != NULL) {
            if (temp->fail->next[i] != NULL) {
              front->next[i]->fail = temp->fail->next[i];
              break;
            }
            temp = temp->fail;
            if (temp == root) {
              front->next[i]->fail = root;
              break;
            }
          }
          if (temp->fail == NULL) front->next[i]->fail = root;
        }
        front->next[i]->ok |= front->next[i]->fail->ok;
        front->next[i]->number += front->next[i]->fail->number;
        q.push(front->next[i]);
      }
    }
  }
}
void del(trie *cur) {
  for (int i = 0; i < 26; i++) {
    if (cur->next[i] != NULL) del(cur->next[i]);
  }
  free(cur);
}
void mul(long long a[][220], long long b[][220]) {
  long long c1[220][220] = {0};
  memset(c1, -1, sizeof(c1));
  for (int i = 0; i < coun; i++) {
    for (int j = 0; j < coun; j++) {
      for (int k = 0; k < coun; k++) {
        if (a[i][k] != -1 && b[k][j] != -1) {
          c1[i][j] = max(c1[i][j], a[i][k] + b[k][j]);
        }
      }
    }
  }
  for (int i = 0; i < coun; i++) {
    for (int j = 0; j < coun; j++) {
      a[i][j] = c1[i][j];
    }
  }
}
void quickmul(long long a[][220], long long l) {
  long long tem1[220][220];
  for (int i = 0; i < coun; i++) {
    for (int j = 0; j < coun; j++) {
      tem1[i][j] = a[i][j];
    }
  }
  long long sum1[220][220] = {0};
  for (int i = 0; i < coun; i++) {
    for (int j = 0; j < coun; j++) {
      sum1[i][j] = a[i][j];
    }
  }
  l--;
  while (l) {
    if (l & 1) {
      mul(sum1, tem1);
    }
    mul(tem1, tem1);
    l /= 2;
  }
  for (int i = 0; i < coun; i++) {
    for (int j = 0; j < coun; j++) {
      a[i][j] = sum1[i][j];
    }
  }
}
int main() {
  int n;
  long long l;
  cin >> n >> l;
  int number[220] = {0};
  memset(ma, -1, sizeof(ma));
  root = (trie *)malloc(sizeof(trie));
  root->id = 0;
  coun = 1;
  for (int i = 0; i < 26; i++) {
    root->next[i] = NULL;
  }
  root->number = 0;
  root->fail = root;
  root->ok = 0;
  pp[0] = root;
  for (int i = 0; i < n; i++) {
    scanf("%d", &number[i]);
  }
  for (int i = 0; i < n; i++) {
    char s[220];
    scanf("%s", s);
    insert(s, number[i]);
  }
  makefail();
  for (int i = 0; i < coun; i++) {
    for (int j = 0; j < 26; j++) {
      trie *tem = pp[i];
      while (tem->next[j] == NULL && tem != root) {
        tem = tem->fail;
      }
      if (tem->next[j] != NULL) {
        ma[i][tem->next[j]->id] = tem->next[j]->number;
      }
    }
    ma[i][0] = 0;
  }
  quickmul(ma, l);
  long long ans = 0;
  for (int i = 0; i < coun; i++) {
    ans = max(ans, ma[0][i]);
  }
  cout << ans << endl;
  del(root);
  return 0;
}
