#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define rfo(x,a,b) for(int x=a; x>=b; x--)
#define fi first
#define sec second
#define mp make_pair
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;

int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t;
    cin>>t;
    fo(z,1,t+1)
    {
        ll n,k;
        cin>>n>>k;
        vi a(n);
        fo(i,0,n) cin>>a[i];
        int ans=0,m=k;
        fo(i,0,n)
        {
            if(a[i]==m)
            {
                m--;
                if(m==0) {ans++; m=k;}
            }
            else m=k;
        }
        cout<<"Case #"<<z<<": "<<ans<<"\n";
    }
    return 0;
}