N,K=map(int,input().split()) mod=10**9+7 import math def fact(x): L=int(math.sqrt(x)) FA=dict() for i in range(2,L+2): while x%i==0: FA[i]=FA.get(i,0)+1 x=x//i if x!=1: FA[x]=FA.get(x,0)+1 return FA FACT=[1] for i in range(1,2*10**5+1): FACT.append(FACT[-1]*i%mod) FACT_INV=[pow(FACT[-1],mod-2,mod)] for i in range(2*10**5,0,-1): FACT_INV.append(FACT_INV[-1]*i%mod) FACT_INV.reverse() def Combi(a,b): if 0<=b<=a: return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod else: return 0 F1=fact(N) F2=fact(K) LIST=[] for f in F1: if f in F2: LIST.append(f) ANS=0 count=1 while LIST: for s in LIST: ANS=(ANS+Combi(N//s,K//s)*count)%mod if len(LIST)==1: break else: LIST2=[] for i in range(len(LIST)): for j in range(i+1,len(LIST)): LIST2.append(LIST[i]*LIST[j]) LIST=LIST2 count*=-1 print(ANS)