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.
import java.util.*;
import java.io.*;

public class Legen {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMMMM      MMMMMM      OOO      OOO        SSSS   SSS     EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEE           MMMM MMM  MMM MMMM    OOO          OOO    SSSS       SSS   EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM  MMMMMM  MMMM   OOO            OOO   SSSS             EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM  OOO              OOO   SSSSSSS         EEEEE          /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO      SSSSSS       EEEEEEEEEEE    /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO         SSSSSSS   EEEEEEEEEEE    /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM   OOO            OOO              SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM    OOO          OOO     SSS       SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM      OOO      OOO        SSS    SSSS    EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    static long[][] matMul(long[][] A, long[][] B, int p, int q, int r)    //C(p x r) = A(p x q) x (q x r) -- O(p x q x r)
    {
        long[][] C = new long[p][r];
        for (long[] x : C) Arrays.fill(x, -(long) 1e17);
        for (int i = 0; i < p; ++i)
            for (int j = 0; j < r; ++j)
                for (int k = 0; k < q; ++k) {
                    if (A[i][k] >= 0 && B[k][j] >= 0)
                        C[i][j] = Math.max(A[i][k] + B[k][j], C[i][j]);
                }
        return C;
    }

    /*
     * 4. Square Matrix Exponentiation
     */
    static long[][] matPow(long[][] base, long p) {
        int n = base.length;
        long[][] ans = new long[n][n];
        for (long[] x : ans) Arrays.fill(x, (long) -1e17);
        for (int i = 0; i < n; i++)
            ans[i][i] = 0;
//        p--;
        while (p != 0) {
            if ((p & 1) == 1)
                ans = matMul(ans, base, n, n, n);
            base = matMul(base, base, n, n, n);
            p >>= 1;
        }

        return ans;
    }

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        long l = sc.nextLong();
        int[] a = sc.nextIntArr(n);
        AhoCorasick ah = new AhoCorasick(500);
        for (int i = 0; i < n; i++) {
            char[] s = sc.next().toCharArray();
            ah.addString(s, a[i]);
        }
        int sz = ah.nodeCount;
        long[][] mat = new long[sz][sz];
        for (long[] x : mat)
            Arrays.fill(x, (long) -1e17);
        int[]vals= new int[sz+1];
        for (int i = 0; i<sz;i++) {
            int add=0;
//            ah.nodes[i].val += ah.nodes[ah.link(i)].val;
            int cur = i;
            while (cur!=0){
                add+=ah.nodes[cur].val;
                cur=ah.link(cur);
            }
            vals[i]=add;
        }

        for (int i = 0; i < sz; i++) {
            for (int j = 0; j < 26; j++) {
                int nxt = ah.go(i, j);
                mat[i][nxt] = Math.max(mat[i][nxt], vals[nxt]);
            }
        }
        long[][] ans = matPow(mat, l);
//        System.err.println(Arrays.toString(ans[0]));
        long max = 0;
        for (long c : ans[0]) max = Math.max(max, c);
        pw.println(max);
        pw.flush();
    }

    static class AhoCorasick {

        static final int k = 26;

        static class Node {
            int p, c, link = -1;
            long val = 0;
            boolean leaf;

            Node(int a, int b) {
                p = a;
                c = b;
            }

            int[] next = new int[26], go = new int[26];

            {
                Arrays.fill(next, -1);
                Arrays.fill(go, -1);
            }
        }

        Node[] nodes;
        int nodeCount;

        AhoCorasick(int maxNodes) {
            nodes = new Node[maxNodes];
            nodes[nodeCount++] = new Node(0, -1);
        }

        void addString(char[] s, int v) {
            int cur = 0;
            for (char ch : s) {
                int c = ch - 'a';
                if (nodes[cur].next[c] == -1) {
                    nodes[nodeCount] = new Node(cur, c);
                    nodes[cur].next[c] = nodeCount++;
                }
                cur = nodes[cur].next[c];
            }
            nodes[cur].leaf = true;
            nodes[cur].val += v;
        }

        int link(int vIdx) {
            Node v = nodes[vIdx];
            if (v.link == -1)
                v.link = v.p == 0 ? 0 : go(link(v.p), v.c);
            return v.link;
        }

        int go(int vIdx, int c) {
            Node v = nodes[vIdx];
            if (v.go[c] == -1)
                v.go[c] = v.next[c] != -1 ? v.next[c] : vIdx == 0 ? 0 : go(link(vIdx), c);
            return v.go[c];
        }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int[] nextIntArr(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }

}
