from operator import mul from functools import reduce n, m = map(int, input().split()) mod = 1000000007 def cmb(n,r): r = min(n-r,r) if r == 0: return 1 over = reduce(mul, range(n, n - r, -1)) under = reduce(mul, range(1,r + 1)) return over // under ans = 0 for i in range(n, m+1): ans += cmb(i, n) % mod ans %= mod print(ans)