/* Problem 4--The Hamming Distance Problem
   This was a simple matter of advancing through the valid strings in
   numerical order. */

import java.io.*;
import java.util.*;
import java.math.*;

public class prob4 {

 public static BufferedReader in;
 public static PrintStream out;
 public static StringTokenizer st;

 public static void main (String[] args) throws Exception {

  in = new BufferedReader (new FileReader ("prob4.in"));
  out = new PrintStream (new FileOutputStream ("prob4.out"));
  int cs=1;
  while (true) { //read in the data
   st = new StringTokenizer (in.readLine());
   int n = Integer.parseInt (st.nextToken()),
       t = Integer.parseInt (st.nextToken());
   if (n==0) break;
   out.println ("Case "+cs++);
   out.println ();
   String HD = null; //print it all out
   while ((HD=next (HD,n,t))!=null)
    out.println (HD);
   out.println ();
  }
 }

/* next given a string HD of length n with t 1's returns the next such
   string in numerical order. */
 public static String next (String HD, int n, int t) {

  if (HD==null) { //if null is the argument it generates and returns
   HD = "";       //the first string
   for (int i=0; i < n-t; i++) HD += "0";
   for (int i=0; i < t; i++) HD += "1";
   return HD;
  }
  int pos = HD.length()-1; //otherwise, push the rightmost 1 (that can
  for (int i=0; i < t; i++) {//be pushed) to the left one space,
   for (; HD.charAt(pos)=='0'; pos--);//pushing all following 1's to the
   if (pos > 0 && HD.charAt (pos-1)=='0') {//far right.
    String NHD = HD.substring (0,pos-1)+"1";
    for (int j=0; j < n-pos-i; j++) NHD+="0";
    for (int j=0; j < i; j++) NHD+="1";
    return NHD;
   }
   pos--;
  }
  return null;
 }
}

