from functools import lru_cache import math class Modint: MOD = int(1e9+7) def __init__(self, value: int) -> None: self.num = int(value) % self.MOD def __str__(self) -> str: return str(self.num) __repr__ = __str__ def __add__(self, __x): if isinstance(__x, Modint): return Modint((self.num + __x.num)) return Modint(self.num + __x) def __sub__(self, __x): if isinstance(__x, Modint): return Modint(self.num - __x.num) return Modint(self.num - __x) def __mul__(self, __x): if isinstance(__x, Modint): return Modint(self.num * __x.num) return Modint(self.num * __x) __radd__ = __add__ __rmul__ = __mul__ def __rsub__(self, __x): if isinstance(__x, Modint): return Modint(__x.num - self.num) return Modint(__x - self.num) def __pow__(self, __x): if isinstance(__x, Modint): return Modint(pow(self.num, __x.num, self.MOD)) return Modint(pow(self.num, __x, self.MOD)) def __rpow__(self, __x): if isinstance(__x, Modint): return Modint(pow(__x.num, self.num, self.MOD)) return Modint(pow(__x, self.num, self.MOD)) def __truediv__(self, __x): if isinstance(__x, Modint): return Modint(self.num * pow(__x.num, self.MOD - 2, self.MOD)) return Modint(self.num * pow(__x, self.MOD - 2, self.MOD)) def __rtruediv__(self, __x): if isinstance(__x, Modint): return Modint(__x.num * pow(self.num, self.MOD - 2, self.MOD)) return Modint(__x * pow(self.num, self.MOD - 2, self.MOD)) def main(): N, M = map(int, input().split()) sum_ = Modint(0) # for num in range(N, M+1): # current = math.factorial(num) // math.factorial(num-N) # sum_ += current # print(current) current = -1 for num in range(N, M+1): if current == -1: current = Modint(math.factorial(num)) else: current = current * num / (num - N) sum_ += current print(sum_ / math.factorial(N)) if __name__ == "__main__": main()