import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  } main {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int count = 0; count 0 while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    } a>0 a 0 {
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    } int min = (int) Math.pow(b,count+1); min (int) Math.pow(b,count+1) Math.pow Math b count+1 count 1 int minus = (int) a%min; minus (int) a%min (int) a min a -= minus a minus count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int count = 0;
    while (a>0){
      int min = (int) Math.pow(b,count+1);
      int minus = (int) a%min;
      a -= minus;
      count++;
    }
    System.out.println(count);
  }
}
