// Arup Guha
// 3/12/2018
// Solution to 2018 UCF HS Contest Problem: Increasing Photo

import java.util.*;
import java.io.*;

public class increasing {

	final public static long MOD = 1000000007L;

	public static void main(String[] args) throws Exception {

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		int nC = Integer.parseInt(stdin.readLine().trim());

		// Process each case.
		for (int loop=1; loop<=nC; loop++) {

			// Get n and k.
			StringTokenizer tok = new StringTokenizer(stdin.readLine());
			int n = Integer.parseInt(tok.nextToken());
			int k = Integer.parseInt(tok.nextToken());

			// Get all heights.
			int[] vals = new int[n];
			int[] cp = new int[n];
			tok = new StringTokenizer(stdin.readLine());
			for (int i=0; i<n; i++) {
				vals[i] = Integer.parseInt(tok.nextToken());
				cp[i] = vals[i];
			}

			// Sort the copy.
			Arrays.sort(cp);

			// Store a mapping from each item to its relative ordering 1 to n.
			HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
			for (int i=0; i<n; i++) map.put(cp[i], i+1);

			// Compress data.
			for (int i=0; i<n; i++)
				vals[i] = map.get(vals[i]);

			// Output the result.
			System.out.println("Class #"+loop+": "+solve(vals, k));
		}
	}

	public static long solve(int[] vals, int k) {

		int n = vals.length;

		// Simple cases.
		if (k == 1) return n;
		if (k > n) return 0;

		// Answers for streak of length 1.
		long[] cur = new long[n];
		Arrays.fill(cur, 1);

		// Iterate building answers from previous answers.
		for (int i=0; i<k-1; i++) {

			long[] next = new long[n];
			bit mybit = new bit(n);

			// Number of streaks of length i+1
			mybit.add(vals[i], cur[i]);

			// Now figure out the rest of the streaks.
			for (int j=i+1; j<n; j++) {

				// This is all streaks of size i+1 that end at j or before next[j-1] is before,
				// the sum of the bit at or below vals[j] is everything that ends at vals[j].
				next[j] = mybit.sum(vals[j])%MOD;

				// Have to adjust our bit.
				mybit.add(vals[j], cur[j]);
			}

			// Copy next into cur for the next round.
			cur = Arrays.copyOf(next, n);
		}

		// Sum up our answer, the # of streaks of length k that end at each item.
		long res = 0;
		for (int j=0; j<n; j++)
			res = (res + cur[j])%MOD;
		return res;
	}
}

class bit {

	public long[] cumfreq;

	// Do indexes 1 to n.
	public bit(int n) {
		int size = 1;
		while (size < n) size <<= 1;
		n = size;
		cumfreq = new long[n+1];
	}

	// Uses 1 based indexing.
	public void add(int index, long value) {
		while (index < cumfreq.length) {
			cumfreq[index] += value;
			index += Integer.lowestOneBit(index);
		}
	}

	// Returns the sum of everything upto index.
	public long sum(int index) {
		long ans = 0;
		while (index > 0) {
			ans += cumfreq[index];
			index -= (Integer.lowestOneBit(index));
		}
		return ans;
	}
}