MOD = 10**9 + 7 n, m = map(int, input().split()) k = n + 1 target = m + 1 if k > target: print(0) else: # Precompute factorial up to target max_fact = target fact = [1] * (max_fact + 1) for i in range(1, max_fact + 1): fact[i] = fact[i-1] * i % MOD # Precompute inverse factorial inv_fact = [1] * (max_fact + 1) inv_fact[max_fact] = pow(fact[max_fact], MOD-2, MOD) for i in range(max_fact - 1, -1, -1): inv_fact[i] = inv_fact[i+1] * (i+1) % MOD ans = fact[target] * inv_fact[k] % MOD ans = ans * inv_fact[target - k] % MOD print(ans)