Problem: 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.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        int maxN = 205;
        int sz = 1;
        int[][] go = new int[maxN][26];
        int[] link = new int[maxN];
        long[] cost = new long[maxN];
        int[] pCh = new int[maxN];
        int[] pV = new int[maxN];
        int[] sumCost;
        boolean[][] gr;

        {
            ArrayUtils.fill(go, -1);
            Arrays.fill(link, -1);
            pCh[0] = -1;
            pV[0] = -1;
        }

        void add(String s, int ai) {
            int v = 0;
            for (int i = 0; i < s.length(); i++) {
                int ch = s.charAt(i) - 'a';
                if (go[v][ch] == -1) {
                    go[v][ch] = sz;
                    pCh[sz] = ch;
                    pV[sz] = v;
                    v = sz;
                    ++sz;
                } else {
                    v = go[v][ch];
                }
            }
            cost[v] += ai;
        }

        int go(int v, int ch) {
            if (go[v][ch] == -1) {
                if (v != 0) {
                    int link = getLink(v);
                    go[v][ch] = go(link, ch);
                } else {
                    go[v][ch] = 0;
                }
            }
            return go[v][ch];
        }

        private int getLink(int v) {
            if (v == 0) {
                return -1;
            }
            if (link[v] == -1) {
                int link = getLink(pV[v]);
                if (link == -1) {
                    this.link[v] = 0;
                } else {
                    this.link[v] = go(link, pCh[v]);
                }
            }
            return link[v];
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n;
            long length;
            int[] a;
            String[] words;

            n = in.readInt();
            length = in.readLong();
            a = IOUtils.readIntArray(in, n);
            words = IOUtils.readStringArray(in, n);

            for (int i = 0; i < n; i++) {
                add(words[i], a[i]);
            }

            gr = new boolean[sz][sz];
            for (int v = 0; v < sz; v++) {
                getLink(v);
//            out.printLine(v, getLink(v));
                for (int ch = 0; ch < 26; ch++) {
                    gr[v][go(v, ch)] = true;
                }
            }

            sumCost = new int[sz];
            for (int v = 0; v < sz; v++) {
                for (int link = v; link != 0; link = getLink(link)) {
                    sumCost[v] += cost[link];
                }
            }


            Item mat = getMat(length);
            long answer = 0;
            for (int to = 0; to < sz; to++) {
                if (mat.can[0][to]) {
                    answer = Math.max(answer, mat.cost[0][to]);
                }
            }
            out.printLine(answer);
//        out.printLine(go(8, 'h' - 'a'));
//        out.printLine(go(5, 'h' - 'a'));
        }

        private Item getMat(long length) {
            Item res = new Item();
            if (length == 0) {
                throw new RuntimeException();
            } else if (length == 1) {
                for (int v = 0; v < sz; v++) {
                    for (int to = 0; to < sz; to++) {
                        if (gr[v][to]) {
                            res.cost[v][to] = sumCost[to];
                            res.can[v][to] = true;
                        }
                    }
                }
            } else {
                Item half = getMat(length / 2);
                for (int v = 0; v < sz; v++) {
                    for (int to = 0; to < sz; to++) {
                        for (int mid = 0; mid < sz; mid++) {
                            if (half.can[v][mid] && half.can[mid][to]) {
                                res.cost[v][to] = Math.max(res.cost[v][to],
                                        half.cost[v][mid] + half.cost[mid][to]);
                                res.can[v][to] = true;
                            }
                        }
                    }
                }
                if (length % 2 == 1) {
                    Item newItem = new Item();
                    for (int s = 0; s < sz; s++) {
                        for (int e = 0; e < sz; e++) {
                            if (res.can[s][e]) {
                                for (int next = 0; next < sz; next++) {
                                    if (gr[e][next]) {
                                        newItem.cost[s][next] = Math.max(newItem.cost[s][next],
                                                res.cost[s][e] + sumCost[next]);
                                        newItem.can[s][next] = true;
                                    }
                                }
                            }
                        }
                    }
                    res = newItem;
                }

            }
            return res;
        }

        class Item {
            boolean[][] can;
            long[][] cost;

            Item() {
                can = new boolean[sz][sz];
                cost = new long[sz][sz];
            }

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void printLine(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class ArrayUtils {
        public static void fill(int[][] array, int value) {
            for (int[] row : array) {
                Arrays.fill(row, value);
            }
        }

    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

        public static String[] readStringArray(InputReader in, int size) {
            String[] array = new String[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readString();
            }
            return array;
        }

    }
}