N,K=map(int,input().split()) # N=p*A+K LIST=[] for i in range(1,10**6+5): if (N-K)%i==0: LIST.append(i) LIST.append((N-K)//i) ANS=0 for s in set(LIST): if N%s==K: ANS+=1 print(ANS)