N,M = map(int,input().split()) P = 10 ** 9 + 7 fact = [1] * (M+1) fact_inv = [1] * (M+1) for i in range(2,M+1): fact[i] = fact[i-1] * i % P fact_inv[-1] = pow(fact_inv[-1],P-2,P) for i in range(M-1,1,-1): fact_inv[i] = fact_inv[i+1] * (i+1) % P def comb(n,k): return fact[n] * fact_inv[k] % P * fact_inv[n-k] % P ans = 0 for i in range(M-N+1): ans = (ans + comb(N+i,N)) % P print(ans)