usingnamespace std; constint N = 1010, mod = 1e9 + 7; int f[N]; int n, m, len; int a[N], b[N]; int t[N];
inlineintread() { int x = 0, y = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') y = -1; c = getchar();} while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar(); return x * y; }
inlineintfind(int x) { returnlower_bound(b + 1, b + len + 1, x) - b; }
inlineintlowbit(int x) { return x & -x; }
inlinevoidadd(int x, int k) { for (int i = x; i <= n; i += lowbit(i)) t[i] = (t[i] + k) % mod; }
inlineintquery(int x) { int res = 0; for (int i = x; i; i -= lowbit(i)) res = (res + t[i]) % mod; return res; }
intmain() { int u = read(); for (int c = 1; c <= u; c++) { n = read(), m = read(); for (int i = 1; i <= n; i++) a[i] = read(), b[i] = a[i]; sort(b + 1, b + 1 + n); len = unique(b + 1, b + n + 1) - b - 1; for (int i = 1; i <= n; i++) a[i] = find(a[i]); for (int i = 1; i <= n; i++) f[i] = 1; for (int i = 2; i <= m; i++) { memset(t, 0, sizeof t); for (int j = 1; j <= n; j++) add(a[j], f[j]), f[j] = query(a[j] - 1); } int res = 0; for (int i = 1; i <= n; i++) res = (res + f[i]) % mod; printf("Case #%d: %d\n", c, res); } return0; }