Yet Another Array Problem#12363

Yet Another Array Problem

1.5 seconds
256 megabytes
Easy

You are given a set of distinct decimal digits.

Using only these digits, you may form positive integers of fixed length. A number cannot contain digits outside the given set and it cannot start with digit .

Your task is to construct an array of length . Each element of the array must be a valid number of length formed according to the rules above.

How many different arrays can be constructed?

O(sqrt(n) solution Since the answer may be large, output it modulo 10^9 + 7.

Input

The first line contains one integer (1 \le t \le 10^3) the number of test case.

The first line of each test case contains two integers and (1 \le m \le 10, 1 \le n \le 10^9).

The second line of each test case contains distinct integers d_1, d_2, \dots, d_m (0 \le d_i \le 9) — the allowed digits.

Output

Print a single integer — the number of different valid arrays modulo 10^9 + 7.

Examples

Example 1

Loading
Loading

Scoring

  1. Subtask : ( points) : (n,m \le 5).

  2. Subtask : ( points) : (n,m \le 10).

  3. Subtask : ( points) : No additional constraints.