from collections import * from itertools import * from functools import * import math,sys input = sys.stdin.readline mod = 10**9 + 7 N,M = map(int,input().split()) ans = 1 for i in range(N+1): ans *= M+1-i ans %= mod ans *= pow(N+1-i,mod-2,mod) ans %= mod print(ans)