#include <iostream> using namespace std; int n,k,ans; int main() { cin>>n>>k; int ans=0; while(n) { if(n%k>0) ans++; n/=k; } cout<< ans<< endl; return 0; }