/* Problem 1--Twenty Questions
   This was very straightforward; one of the easiest problems I've ever
   seen in this competition. */

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main (int argc, char **argv);

int main (int argc, char **argv) {

  FILE *in, *out;
  int N, K, M, r;
  double Md;

 in = fopen ("prob1.in","r");
 out = fopen ("prob1.out","w");
 for (;;) {
  fscanf (in,"%d %d",&K,&N);
 if (N==0 && K==0) break;
  Md = log(N)/log(K);  /* compute log_K (N) */
  if (fabs (Md-(int)(Md+0.5)) < 1e-8) { /* round up; watch out for */
   M = Md+0.5;                          /* round-off error */
  } else {
   M = Md+1;
  }
  fprintf (out,"%d items, %d answers per question, %d questions\n",
               N,K,M+1);
 }
 fclose (in);
 fclose (out);
 r = EXIT_SUCCESS;
 return r;
}
