import math n,p=list(map(float,input().split())) a=[1]*(int(n)) n=int(n) nr=math.ceil(n**0.5) for i in range(2,nr): for j in range(1,n//i): a[i*j-1]+=1 b=[0 if k==1 else pow(p,k-1) for k in a] print(sum(b))