GEN - Text Generator

题意翻译

给定n(n<=10)个字符串(长度<=6),要求构造一个长度为L(<=10^6)的字符串,至少包含n个字符串中任何一个,求方案数mod10007的值(所有字符都是大写字母) 输入为多组数据,每组数据第一行N,L,接下来N行每行一个字符串

题目描述

LoadingTime has been given a task these days. He is required to write a tool called Text Generator. This software is widely used among the kids who are under seven. It generates an article with the size of a given number L for users. If an article contains at least one word which the users know, we consider it readable. Now, LoadingTime wants to know, how many readable articles can it generates, and he can improve his Text Generator. Could you help him??

输入输出格式

输入格式


The input contains multiple test cases. The first line of each test case contains two integer N (1 <= N <= 10), L (1 <= L <= 1000000). The following N lines contain N words representing the words knew by the users. All the words and the generated article only contain uppercase letters, and the length of each word is not greater than 6.

输出格式


For each test case, your program should output a integer as LoadingTime required. As the number could be quite large, you only need to print the answer modulo 10007.

输入输出样例

输入样例 #1

2 2
A
B
2 10000
ABC
B

输出样例 #1

100
5960