import java.util.*;

public class Maher {
  public static Scanner in;
  public static int caseNum;
  public static int n,k;
  public static String name[];

  public static void main(String[] args) {
    in = new Scanner(System.in);
    caseNum = 0;
    n = in.nextInt();
    k = in.nextInt();
    while (n > 0 && k > 0) {
      caseNum++;
      if (caseNum > 1)
        System.out.println();
      name = new String[n];
      for (int i = 0; i < n; i++)
        name[i] = in.next();
      sort(name); 
      boolean ok = true;
      for (int i = 0; i < n/k; i++) {
        double sum = 0.0;
        for (int j = i*k; j < k*(i+1); j++) {
           sum += name[j].length();
        }
        sum = sum/k;
        for (int j = i*k; j < k*(i+1); j++)
           if (Math.abs(name[j].length() - sum) > 2) {
             ok = false;
             break;
           }
        if (!ok) break;
      }
      System.out.print("Case " + caseNum + ": ");
      if (ok)
        System.out.println("yes");
      else
        System.out.println("no");
      n = in.nextInt();
      k = in.nextInt();
    }
  }

  public static void sort(String[] name) {
    // insertion sort
    for (int i = 1; i < n; i++) {
      String temp = name[i];
      int j = i-1;
      while (j >= 0 && name[j].length() > temp.length()) {
        name[j+1] = name[j];
        j--;
      }
      name[j+1] = temp;
    }
  }

  public static void print() {
    for (int i = 0; i < n; i++)
      System.out.println(name[i]);
  }
}
