Nasser's Prime Slices#12432

Nasser's Prime Slices

2 seconds
256 megabytes
Easy

Nasser gives you an array of length and an integer .

You need to find the number of ways to slice the array into contiguous subarrays such that every subarray contains exactly prime numbers. must use fft

Two ways are considered different if the set of cutting positions is different.

Since the answer can be very large, output it modulo must use fft 10^9+7.

Input

Each test contains multiple test cases. The first line contains a single integer (1 \le t \le 10^4) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers and (1 \le n \le 2 \cdot 10^5, 1 \le k \le n) — the length of the array and the required number of primes per subarray.

The second line of each test case contains integers a_1, a_2, \ldots, a_n (1 \le a_i \le 10^7) — the elements of the array.

It is guaranteed that the sum of over all test cases does not exceed 2 \cdot 10^5.

Output

For each test case, print a single integer — the number of ways to slice the array satisfying the condition, modulo 10^9+7.

Examples

Example 1

Loading
Loading

Note

In the first test case, n = 6, k = 2, and a = [2, 3, 5, 7, 11, 13]. All elements are prime, so the only valid slicing is [2, 3] \mid [5, 7] \mid [11, 13], giving 1 way.

In the fourth test case, n = 6, k = 2, and a = [2, 2, 1, 1, 2, 2].

  • [2, 2] \mid [1, 1, 2, 2]

  • [2, 2, 1] \mid [1, 2, 2]

  • [2, 2, 1, 1] \mid [2, 2]

This gives 3 ways.

Scoring

  1. Subtask ( points) : No additional constraints.