//* Problem  : 2563 - Mahershalalhashbaz, Nebuchadnezzar, and Billy Bob Benjamin Go to the Regionals
//* Contest  : acm.tju.edu.cn
//* Type     : Solution
//* Date     : 2007.08.01
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

int n, k, res;
int a[1000];
char s[1000];

int cmp_f(const void *a, const void *b)
{
	int *aa = (int*)a, *bb = (int*)b;
	return (aa[0] - bb[0]);
} 
int main()
{
	int i, j, av, it = 0;
	while (scanf("%i %i", &n, &k) == 2 && (n || k))
	{
		if (it) putchar('\n'); it++;
		res = 1;
		for (i = 0; i < n; i++)
		{
			scanf("%s", s); a[i] = strlen(s);
		}
		qsort(a, n, sizeof(a[0]), cmp_f);
		for (i = 0; i < n/k && res; i++)
		{
			av = 0;
			for (j = k*i; j < k*(i+1); j++)
				av += a[j];
			for (j = k*i; j < k*(i+1); j++)
				if (abs(av - a[j]*k) > 2*k) {res = 0; break;}
		}
		printf("Case %i: ", it);
		if (res) printf("yes\n");
			else printf("no\n");
	}
}