You are given two integers $n$ and $m$. Calculate the number of pairs of arrays $(a, b)$ such that:

  the length of both arrays is equal to $m$;  each element of each array is an integer between $1$ and $n$ (inclusive);  $a_i \le b_i$ for any index $i$ from $1$ to $m$;  array $a$ is sorted in non-descending order;  array $b$ is sorted in non-ascending order. 

As the result can be very large, you should print it modulo $10^9+7$.


-----Input-----

The only line contains two integers $n$ and $m$ ($1 \le n \le 1000$, $1 \le m \le 10$).


-----Output-----

Print one integer – the number of arrays $a$ and $b$ satisfying the conditions described above modulo $10^9+7$.


-----Examples-----
Input
2 2

Output
5

Input
10 1

Output
55

Input
723 9

Output
157557417



-----Note-----

In the first test there are $5$ suitable arrays:   $a = [1, 1], b = [2, 2]$;  $a = [1, 2], b = [2, 2]$;  $a = [2, 2], b = [2, 2]$;  $a = [1, 1], b = [2, 1]$;  $a = [1, 1], b = [1, 1]$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Dynamic programming

Combinatorics


Solutions:
import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
mod = 10 ** 9 + 7

def Combi2(a, b):
	if b > a:
		return 0
	ANS = 1
	for i in range(min(b, a - b)):
		ANS = ANS * (a - i) * pow(min(b, a - b) - i, mod - 2, mod) % mod
	return ANS % mod
print(Combi2(n - 1 + m * 2, m * 2))


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def modDivide(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		print('Division not defined')
	else:
		return inv * a % m

def fun(N, m):
	j = 1
	k = 1
	for i in range(1, m + 1):
		j = j * (N + i - 1) % 1000000007
		k = k * i % 1000000007
	return modDivide(j, k, 1000000007)

def main():
	(n, m) = cin()
	mod = 1000000007
	y = ans = 0
	for i in range(1, n + 1):
		x = fun(i, m)
		j = (x - y + mod) % mod
		y = x % mod
		xx = fun(n - i + 1, m)
		ans = (ans + xx * j % mod) % mod
	print(int(ans))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


mod = 10 ** 9 + 7

def cmb(n, r, mod=mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
NN = 10 ** 5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, NN + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
(N, M) = map(int, input().split())
ans = cmb(2 * M + N - 1, N - 1)
print(ans)


p = 10 ** 9 + 7
(n, m) = (int(i) for i in input().split())
res = 1
for i in range(n, 2 * m + n):
	res *= i
for i in range(1, 2 * m + 1):
	res = res // i
print(int(res) % p)


def C(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
from math import factorial
(n, m) = map(int, input().split())
print(C(n + 2 * m - 1, 2 * m) % (10 ** 9 + 7))


from math import factorial as fact

def countPairs(m, n):
	ans = fact(2 * m + n - 1) // (fact(n - 1) * fact(2 * m))
	return ans % (10 ** 9 + 7)
(n, m) = map(int, input().split())
print(countPairs(m, n))


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
DP = [[0] * (n + 1) for i in range(n + 1)]
for i in range(1, n + 1):
	for j in range(i, n + 1):
		DP[i][j] = 1
for t in range(m - 1):
	for i in range(1, n + 1):
		for j in range(n - 1, i - 1, -1):
			DP[i][j] = (DP[i][j + 1] + DP[i][j]) % mod
	for j in range(n, -1, -1):
		for i in range(2, j + 1):
			DP[i][j] = (DP[i - 1][j] + DP[i][j]) % mod
ANS = 0
for d in DP:
	ANS = ANS + sum(d) % mod
print(ANS % mod)


(n, m) = map(int, input().split())
dp = [[1 for i in range(n)] for j in range(m)]
for i in range(1, m):
	for j in range(n):
		c = 0
		for l in range(j + 1):
			c += dp[i - 1][l]
		dp[i][j] = c
a = dp[m - 1][:]
a.reverse()
for i in range(1, n):
	dp[m - 1][i] += dp[m - 1][i - 1]
ans = 0
for i in range(n):
	ans += dp[m - 1][i] * a[i]
print(ans % 1000000007)


(n, m) = map(int, input().split())
M = 10 ** 9 + 7

def inv(x):
	return pow(x, M - 2, M)

def binomial(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
			ntok %= M
			ktok %= M
		return ntok * inv(ktok) % M
	else:
		return 0
print(binomial(n + 2 * m - 1, 2 * m))


from math import factorial as fac
mod = 10 ** 9 + 7

def C(n, m):
	return fac(n) // (fac(m) * fac(n - m))
(n, m) = map(int, input().split())
print(C(n + 2 * m - 1, 2 * m) % mod)


MOD = 10 ** 9 + 7

def pow_mod(n, k, mod):
	if k == 0:
		return 1
	if k % 2 == 1:
		return n * pow_mod(n, k - 1, mod) % mod
	else:
		r = pow_mod(n, k // 2, mod)
		return r * r % mod

def mod_inverse(n, mod):
	return pow_mod(n, mod - 2, mod)

def fact_mod(n, mod):
	res = 1
	for i in range(2, n + 1):
		res = res * i % mod
	return res

def choose_mod(n, k, mod):
	return fact_mod(n, mod) * mod_inverse(fact_mod(k, mod), mod) * mod_inverse(fact_mod(n - k, mod), mod) % mod
(n, m) = map(int, input().split())
print(choose_mod(n + 2 * m - 1, 2 * m, MOD))


import math
mod = 1000000007
(n, m) = map(int, input().split())
print(math.factorial(n + 2 * m - 1) // (math.factorial(n - 1) * math.factorial(2 * m)) % mod)


from math import factorial as fact
mod = 10 ** 9 + 7

def nCr(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = map(int, input().split())
print(nCr(n + 2 * m - 1, 2 * m) % mod)


p = 10 ** 9 + 7

def power(x, y, p):
	y = bin(y)[2:]
	start = x
	answer = 1
	for i in range(len(y)):
		if y[len(y) - i - 1] == '1':
			answer = answer * start % p
		start = start * start % p
	return answer

def process(n, m):
	num = 1
	den = 1
	for i in range(2 * m):
		num *= 2 * m + n - 1 - i
		den *= 2 * m - i
	den2 = power(den, p - 2, p)
	return num * den2 % p
(n, m) = [int(x) for x in input().split()]
print(process(n, m))


(n, m) = list(map(int, input().split()))
x = 2 * m + n - 1
y = n - 1
mod = 10 ** 9 + 7
num1 = 1
num2 = 1
for i in range(x, y, -1):
	num1 = num1 * i % mod
for i in range(1, x - y + 1):
	num2 = num2 * i % mod
num2 = pow(num2, mod - 2, mod)
print(num1 * num2 % mod)


import math
MOD = 1000000007

def main():
	(n, m) = [int(x) for x in input().split()]
	m *= 2
	a = [0] * n
	a[0] = 1
	for i in range(m):
		b = [0] * n
		sum = a[0]
		b[0] = a[0]
		for j in range(1, n):
			sum = (sum + a[j]) % MOD
			b[j] = sum
		a = b
	result = 0
	for i in range(n):
		result = (result + a[i]) % MOD
	print(result)

def __starting_point():
	main()
__starting_point()


from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline
import math
(n, m) = list(map(int, input().split()))
mod = 10 ** 9 + 7
dp1 = [[1 for x in range(m + 1)] for y in range(n + 1)]
dp2 = [[1 for y in range(m + 1)] for y in range(n + 1)]
for j in range(2, m + 1):
	for i in range(1, n + 1):
		temp = 0
		for k in range(1, i + 1):
			temp += dp1[k][j - 1]
			temp %= mod
		dp1[i][j] = temp
		temp = 0
		for k in range(i, n + 1):
			temp += dp2[k][j - 1]
			temp %= mod
		dp2[i][j] = temp
ans = 0
for i in range(1, n + 1):
	for k in range(i, n + 1):
		ans += dp1[i][m] * dp2[k][m]
		ans %= mod
print(ans)


import os, sys
from io import BytesIO, IOBase

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
for i in range(1):
	(n, m) = mi()
	ans = 1
	for i in range(n, n + 2 * m):
		ans *= i
	ans //= math.factorial(2 * m)
	print(ans % 1000000007)


(n, m) = list(map(int, input().split()))
MOD = 10 ** 9 + 7
dp_a = [[0 for _ in range(n)] for _ in range(m)]
dp_b = [[0 for _ in range(n)] for _ in range(m)]
for j in range(0, n):
	dp_a[0][j] = 1
for i in range(1, m):
	for j in range(0, n):
		dp_a[i][j] += dp_a[i][j - 1] + dp_a[i - 1][j]
		dp_a[i][j] %= MOD
for i in range(0, m):
	for j in range(0, n):
		dp_b[i][j] += dp_b[i][j - 1] + dp_a[i][j]
		dp_b[i][j] %= MOD
ans = 0
for j in range(0, n):
	ans += dp_a[m - 1][j] * dp_b[m - 1][n - j - 1] % MOD
	ans %= MOD
print(ans % MOD)


def inv(x, y, p):
	ans = 1
	while y != 0:
		if y & 1:
			ans = ans * x % p
		x = x * x % p
		y = int(y // 2)
	return ans % p
mod = 1000000007
(n, m) = map(int, input().split())
fact = [0] * (n + 2 * m)
fact[0] = 1
for i in range(1, n + 2 * m):
	fact[i] = fact[i - 1] * i % mod
ans = fact[n + 2 * m - 1] * inv(fact[2 * m], mod - 2, mod) % mod * inv(fact[n - 1], mod - 2, mod) % mod
print(ans)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
DP = [0] * (n + 1)
DP[0] = 1
for i in range(m):
	nxt = [0] * (n + 1)
	cnt = DP[0]
	for i in range(1, n + 1):
		cnt += DP[i]
		cnt %= mod
		nxt[i] = cnt
	DP = nxt
cnt = 0
ans = 0
for i in reversed(range(1, n + 1)):
	cnt += DP[n - i + 1]
	ans += DP[i] * cnt
	ans %= mod
print(ans)


import math
(n, m) = map(int, input().split())
f = math.factorial
print(f(n + 2 * m - 1) // f(2 * m) // f(n - 1) % (10 ** 9 + 7))


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
(N, M) = MAP()
acc = list2d(N + 1, N + 1, 0)
for i in range(1, N + 1):
	for j in range(i, N + 1):
		acc[i][j] = 1
for _ in range(M - 1):
	for i in range(1, N + 1):
		for j in range(N, i, -1):
			acc[i][j - 1] += acc[i][j]
			acc[i][j - 1] %= MOD
	for j in range(1, N + 1):
		for i in range(1, j):
			acc[i + 1][j] += acc[i][j]
			acc[i + 1][j] %= MOD
ans = 0
for row in acc:
	ans += sum(row)
	ans %= MOD
print(ans)


def f(n):
	return 1 if n == 0 else n * f(n - 1)

def c(n, k):
	return f(n) // f(k) // f(n - k)
M = int(1000000000.0 + 7)
(n, m) = map(int, input().split())
print(c(n + 2 * m - 1, 2 * m) % M)


(n, m) = list(map(int, input().rstrip().split()))
from math import *

def ncr(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p
ans = 0
M = 10 ** 9 + 7
for k in range(1, n + 1):
	t1 = ncr(m + k - 2, m - 1)
	t2 = ncr(m + n - k, m)
	ans = (ans + t1 * t2 % M) % M
print(ans)


s = input().split()
n = int(s[0])
m = int(s[1])
m *= 2
f1 = 1
for i in range(2, n + m):
	f1 *= i
f2 = 1
for i in range(2, n):
	f2 *= i
f3 = 1
for i in range(2, m + 1):
	f3 *= i
md = int(1000000000.0 + 7)
ans = f1 // (f2 * f3) % md
print(ans)


fact = [1, 1]
M = 1000000007
invn = [1, 1]
(n, m) = [int(x) for x in input().split()]
a = n + 2 * m - 1
b = n - 1
c = 2 * m
for i in range(2, a + 1):
	fact.append(i * fact[i - 1] % M)
ans = fact[a] * pow(fact[b], M - 2, M) % M * pow(fact[c], M - 2, M) % M
print(ans)


from sys import stdin, stdout
combi = dict()
dp = dict()
dp2 = dict()

def cal_dp(N, M):
	dp[0, M] = 1
	for i in range(1, N):
		dp[i, M] = dp[i - 1, M] + combi[i, M]
	dp2[0, M] = 1
	for i in range(1, N):
		dp2[i, M] = dp2[i - 1, M] + dp[i, M]

def calculate(N, M):
	if N == 0:
		return 1
	if (N - 1, M) in combi:
		return combi[N - 1, M]
	sums = 0
	for i in range(1, N + 1):
		if i == 1:
			for j in range(N, i - 1, -1):
				sums = sums + calculate(j - i + 1, M - 1)
			if (N - 1, M - 1) not in dp:
				cal_dp(N, M - 1)
		else:
			sums = sums + dp2[N - i, M - 1]
			break
	sums = sums % 1000000007
	combi[N - 1, M] = sums
	return sums

def main():
	arr = list(map(int, stdin.readline().split()))
	N = arr[0]
	M = arr[1]
	sums = 0
	for i in range(0, N):
		sums = (sums + i + 1) % 1000000007
		combi[i, 1] = sums
	combi[i + 1, 1] = sums
	print(calculate(N, M))
main()


def ncr(n, r):
	if n == 1:
		return n
	end = max(r, n - r)
	temp = 1
	for i in range(n, end, -1):
		temp *= i
	return temp // math.factorial(min(r, n - r))
mod = 1000000007
(n, m) = map(int, input().split())
import math
print(ncr(2 * m + n - 1, n - 1) % mod)


MOD = 10 ** 9 + 7
(n, m) = map(int, input().split())
ans = 0
for i in range(1, n + 1):
	dp = [[0 for _ in range(i)] for _ in range(m - 1)]
	for j in range(m - 1):
		d = 0
		for k in range(i):
			if j == 0:
				dp[j][k] = 1
				continue
			d += dp[j - 1][k]
			dp[j][k] = d
	dp2 = [[0 for _ in range(n - i + 1)] for _ in range(m)]
	for j in range(m):
		d = 0
		for k in range(n - i + 1):
			if j == 0:
				dp2[j][k] = 1
				continue
			d += dp2[j - 1][k]
			dp2[j][k] = d
	tmp1 = 0
	tmp2 = 0
	if len(dp) > 0:
		tmp1 = sum(dp[-1]) % MOD
	else:
		tmp1 = 1
	if len(dp2) > 0:
		tmp2 = sum(dp2[-1]) % MOD
	else:
		tmp2 = 1
	ans += tmp1 * tmp2 % MOD
print(ans % MOD)


import sys
input = sys.stdin.readline
flush = sys.stdout.flush

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	(n, m) = lin()
	md = 10 ** 9 + 7
	a = list(range(1, n + 1))
	a1 = [1] * n
	for i in range(m - 1):
		a1 = a[:]
		for j in range(1, n):
			a[j] = (a[j] + a[j - 1]) % md
	ans = 0
	for i in range(n):
		ans += a1[i] * a[n - i - 1]
		ans %= md
	print(ans)
main()


mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(n + 1):
	dp[0][i] = 1
for cnt in range(1, m + 1):
	for mx in range(1, n + 1):
		dp[cnt][mx] = dp[cnt][mx - 1] + dp[cnt - 1][mx]

def dfs(mx, cnt):
	return dp[cnt - 1][mx]

def dfs_r(mx, cnt):
	return dp[cnt][mx]
s = 0
for i in range(1, n + 1):
	left = i
	right = n - i + 1
	s += dfs(left, m) * dfs_r(right, m)
	s %= mod
print(s)


(n, m) = map(int, input().split())

def ncr(n, r, p=1000000007):
	if r > n - r:
		r = n - r
	C = [0 for i in range(r + 1)]
	C[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, r), 0, -1):
			C[j] = (C[j] + C[j - 1]) % p
	return C[r]
ans = 0
for bumps in range(n):
	(N, R) = (bumps, 2 * m)
	ans += ncr(N + R - 1, R - 1)
	ans = ans % 1000000007
print(ans)


md = 10 ** 9 + 7
(n, m) = map(int, input().split())
dp = [0] + [1] * n
for _ in range(2 * m):
	for i in range(1, n + 1):
		a = dp[i]
		b = dp[i - 1]
		dp[i] = (a + b) % md
print(dp[n])


import math

def calculate(p, r):
	return math.factorial(p + r - 1) // math.factorial(r) // math.factorial(p - 1)
Sum = 0
(n, m) = map(int, input().split())
for i in range(1, n + 1):
	Sum = Sum + calculate(i, m - 1) * calculate(n - i + 1, m)
print(Sum % (1000000000 + 7))


from sys import stdin

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())
debugging = False

def dprint(*args):
	if debugging:
		print(*args)
	else:
		pass

def ncr(n, r):
	x = 1
	for k in range(n, r, -1):
		x *= k
		x %= mod
	for k in range(n - r, 1, -1):
		x *= pow(k, mod - 2, mod)
		x %= mod
	return x
mod = 10 ** 9 + 7
(n, m) = intsput()
cnt = 0
for k in range(1, n + 1):
	cnt += ncr(k + m - 2, m - 1) * ncr(n - k + m, m)
	cnt %= mod
print(cnt)


from math import *
mod = 1000000007
tmp = 0
f = []
fact = 1
f.append(fact)
for i in range(1, 2000):
	fact = fact * i % mod
	f.append(fact)

def power(x, y):
	res = 1
	while y:
		if y % 2:
			res = res * x % mod
		y = y // 2
		x = x * x % mod
	return res

def ncr(n, r):
	tmp = power(f[r], mod - 2) * f[n] % mod
	tmp = tmp * power(f[n - r], mod - 2) % mod
	return tmp
(n, m) = [int(x) for x in input().split()]
a = []
a1 = 0
b = 0
ans = 0
for j in range(1, n + 1):
	a1 = (a1 + ncr(j + m - 2, m - 1)) % 1000000007
	a.append(a1)
for i in range(1, n + 1):
	b = ncr(n + m - i - 1, m - 1)
	ans = (ans + b * a[i - 1]) % 1000000007
print(ans)


import math
(N, M) = map(int, input().split())
print(math.factorial(N + M + M - 1) // (math.factorial(N - 1) * math.factorial(M + M)) % 1000000007)


(n, mm) = map(int, input().split())
mod = 10 ** 9 + 7
l = 10 ** 4
M = [1]
m = 1
for i in range(1, l):
	m = m * i % mod
	M.append(m)

def pow(x, y, mod):
	ans = 1
	while y > 0:
		if y % 2 == 1:
			ans = ans * x % mod
		x = x ** 2 % mod
		y //= 2
	return ans

def inv(x, mod):
	return pow(x, mod - 2, mod)
MI = [0] * (l - 1) + [inv(M[l - 1], mod)]
for i in range(l - 2, -1, -1):
	MI[i] = MI[i + 1] * (i + 1) % mod

def C(x, y):
	if y < 0 or y > x:
		return 0
	ans = M[x]
	ans = ans * MI[y] % mod
	return ans * MI[x - y] % mod
ans = 0
for i in range(n):
	ans = (ans + C(mm - 1 + i, i) * C(mm + n - i - 1, n - i - 1)) % mod
print(ans)


def fact(x):
	if x == 0:
		return 1
	return x * fact(x - 1)
(n, m) = map(int, input().split())
e = 10 ** 9 + 7
print(fact(2 * m + n - 1) // (fact(2 * m) * fact(n - 1)) % e)


from math import factorial as fact

def func(a, b):
	return fact(a) // (fact(b) * fact(a - b))
(n, m) = input().split()
n = int(n)
m = int(m)
print(func(n + 2 * m - 1, 2 * m) % 1000000007)


(n, m) = map(int, input().split())
dp = [[0] * 25 for i in range(1005)]
mod = 1000000000.0 + 7
for i in range(1, 2 * m + 1):
	dp[1][i] = 1
for i in range(1, n + 1):
	dp[i][1] = i
for i in range(2, n + 1):
	for j in range(2, 2 * m + 1):
		dp[i][j] = int((dp[i - 1][j] + dp[i][j - 1]) % mod)
print(dp[n][2 * m])


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
from typing import List

def solve(N, M):
	MOD = 10 ** 9 + 7
	dp = [[0 for _ in range(N + 1)] for _ in range(1 + M)]
	for v in range(1, N + 1):
		dp[1][v] = 1
	for i in range(2, M + 1):
		for v in range(1, N + 1):
			dp[i][v] = sum([dp[i - 1][u] for u in range(1, v + 1)])
			dp[i][v] %= MOD
	dp2 = [[0 for _ in range(N + 1)] for _ in range(1 + M)]
	for v in range(1, N + 1):
		dp2[1][v] = 1
	for i in range(2, M + 1):
		for v in range(1, N + 1):
			dp2[i][v] = sum([dp2[i - 1][u] for u in range(v, N + 1)])
			dp2[i][v] %= MOD
	ans = 0
	for v in range(1, N + 1):
		ans += sum([dp[M][v] * dp2[M][u] for u in range(v, N + 1)])
		ans %= MOD
	return ans
(N, M) = map(int, input().split())
print(solve(N, M))


from math import factorial as f
(n, m) = map(int, input().split())
M = 10 ** 9 + 7
print(f(n + 2 * m - 1) // (f(2 * m) * f(n - 1)) % M)


(n, m) = list(map(int, input().split()))
result = 1
for i in range(2 * m):
	result = result * (n + i) // (i + 1)
print(result % (10 ** 9 + 7))


import math

def ncr(n, r):
	if r <= n:
		return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
	else:
		return 0
(n, m) = map(int, input().split())
stars = 2 * m
bars = n - 1
print(ncr(stars + bars, bars) % (10 ** 9 + 7))


(n, m) = input().split()
n = int(n)
m = int(m)
M = pow(10, 9) + 7
ans = 1
for i in range(n, 2 * m + n):
	ans *= i
	ans %= M
r = 1
for i in range(1, 2 * m + 1):
	r *= i
ans *= pow(r, M - 2, mod=M)
ans %= M
print(ans)


import math
(n, m) = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
tmp = math.comb(n + 2 * m - 1, 2 * m)
print(tmp % mod)


import math
MOD = 1000000007
(n, m) = map(int, input().split())
r = 2 * m
a = math.factorial(n + r - 1)
b = math.factorial(r)
c = math.factorial(n - 1)
d = b * c
ans = a // d
print(ans % MOD)


from math import factorial as fact
mod = 10 ** 9 + 7

def C(n, k):
	ans = fact(n) // (fact(k) * fact(n - k))
	return ans
(n, m) = (int(x) for x in input().split())
ans = C(n + 2 * m - 1, 2 * m) % mod
print(ans)


def fact(n):
	f = 1
	for i in range(1, n + 1):
		f *= i
	return f
(n, m) = list(map(int, input().split()))
ans = fact(n + 2 * m - 1) // (fact(2 * m) * fact(n - 1))
print(ans % 1000000007)


from math import factorial as fac
(n, m) = map(int, input().split())
a = fac(2 * m + n - 1)
b = fac(n - 1)
c = fac(2 * m)
print(a // (b * c) % 1000000007)


from math import factorial as fact
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())

def c(a, b):
	return fact(a) // (fact(b) * fact(a - b))
print(c(n + 2 * m - 1, 2 * m) % mod)


(maxval, arrlen) = map(int, input().split())
MOD = 10 ** 9 + 7
dp = [[0 for i in range(maxval)] for j in range(arrlen)]
for i in range(maxval):
	dp[0][i] = 1
for i in range(maxval):
	for j in range(1, arrlen):
		for k in range(i + 1):
			dp[j][i] += dp[j - 1][k]
		dp[j][i] %= MOD
res = 0
for i in range(maxval):
	for j in range(maxval - i):
		res += dp[-1][i] * dp[-1][j]
print(res % MOD)


(n, m) = map(int, input().split())
MOD = 10 ** 9 + 7
current_array = [[0 for i in range(n + 1)] for i in range(n + 1)]
prefix_current_array = [[0 for i in range(n + 1)] for i in range(n + 1)]
for i in range(1, m + 1):
	if i == 1:
		for x in range(1, n + 1):
			for y in range(x, n + 1):
				current_array[x][y] = 1
	else:
		next_array = [[0 for i in range(n + 1)] for i in range(n + 1)]
		for x in range(1, n + 1):
			for y in range(x, n + 1):
				next_array[x][y] = (prefix_current_array[n][y] - prefix_current_array[x - 1][y]) % MOD
		current_array = next_array
	for x in range(1, n + 1):
		current_y_sum = 0
		for y in range(1, n + 1):
			current_y_sum = (current_y_sum + current_array[x][y]) % MOD
			prefix_current_array[x][y] = (current_y_sum + prefix_current_array[x - 1][y]) % MOD
print(prefix_current_array[n][n])


from math import factorial as fact
M = 10 ** 9 + 7

def C(n, k):
	return fact(n) // (fact(k) * fact(n - k))
arr = [int(x) for x in input().split()]
print(C(arr[0] + 2 * arr[1] - 1, 2 * arr[1]) % M)


(frac, mod, a, b, ans) = ([1] * 100001, 1000000007, [0] * 1002, [0] * 1002, 0)
for i in range(1, 100001):
	frac[i] = i * frac[i - 1] % mod

def C(a, b):
	return frac[a] * pow(frac[a - b], mod - 2, mod) % mod * pow(frac[b], mod - 2, mod) % mod
(n, m) = map(int, input().split())
for i in range(1, n + 1):
	a[i] = C(m + i - 2, i - 1)
for i in range(n, 0, -1):
	b[i] = (b[i + 1] + C(m + n - i - 1, n - i)) % mod
for i in range(1, n + 1):
	ans = (ans + a[i] * b[i]) % mod
print(ans)


MOD = 1000000007
(n, m) = map(int, input().split())
cur = [1 for i in range(m + n)]
for i in range(1, m):
	prev = cur[i - 1]
	cur[i - 1] = 0
	for j in range(i, m + n):
		(prev, cur[j]) = (cur[j], (prev + cur[j - 1]) % MOD)
prev = [cur[i] for i in range(m + n)]
cur[m - 1] = 0
for i in range(m, m + n):
	cur[i] = (cur[i - 1] + prev[i - 1]) % MOD
sum = 0
for i in range(1, n + 1):
	sum = (sum + prev[m + i - 2] * cur[m + n - i] % MOD) % MOD
print(sum)


import math
(a, b) = list(map(int, input().split(' ')))
modulo = 10 ** 9 + 7

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
ans = 0
for i in range(a):
	cur = nCr(b - 1 + i, i) * nCr(a + b - 1 - i, a - 1 - i)
	ans += cur
	ans = ans % modulo
print(ans % modulo)


from math import factorial as f
(n, m) = map(int, input().split())
m = 2 * m
p = 1
for i in range(m):
	p *= n
	n += 1
N = 10 ** 9 + 7
print(p // f(m) % N)


(n, m) = map(int, input().split())
m *= 2
ll = [0] * (m + 1)
dp = []
for _ in range(n + 1):
	dp.append(list(ll))
for i in range(m + 1):
	dp[1][i] = 1
for i in range(2, n + 1):
	for j in range(1, m + 1):
		for k in range(1, j + 1):
			dp[i][j] += dp[i - 1][k]
ans = 0
for i in range(1, n + 1):
	ans += dp[i][m]
print(ans % (10 ** 9 + 7))


from collections import *
from math import factorial

def nCr(n, r):
	(f, m) = (factorial, 1)
	for i in range(n, n - r, -1):
		m *= i
	return int(m // f(r))
(n, m) = map(int, input().split())
(mem, ans, mod) = (defaultdict(int), 0, 1000000007)
for i in range(n):
	ans += nCr(m - 1 + i, m - 1)
print(nCr(n + 2 * m - 1, 2 * m) % mod)


from math import factorial as fact
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
print(fact(n + 2 * m - 1) // (fact(2 * m) * fact(n - 1)) % mod)


def nCr(n, r):
	fac = list()
	fac.append(1)
	for i in range(1, n + 1):
		fac.append(fac[i - 1] * i)
	ans = fac[n] // (fac[n - r] * fac[r])
	return ans
(n, m) = map(int, input().split())
mod = 1000000000 + 7
res = int(nCr(n + 2 * m - 1, 2 * m))
print(res % mod)


import math
mod = 10 ** 9 + 7

def cbn(n, k):
	return math.factorial(n) // (math.factorial(k) * math.factorial(n - k))
(k, n) = map(int, input().split(' '))
print(cbn(2 * n + k - 1, 2 * n) % mod)


def inv(x):
	return pow(x, MOD - 2, MOD)

def C(n, r):
	return fact[n] * inv_table[r] * inv_table[n - r]
(n, m) = map(int, input().split())
ans = 0
MOD = 10 ** 9 + 7
fact = [1]
for i in range(1, 2000):
	fact.append(fact[-1] * i % MOD)
inv_table = [-1] * 2000
for i in range(2000):
	inv_table[i] = inv(fact[i])
for i in range(1, n + 1):
	ans += C(i - 1 + m - 1, m - 1) * C(n - i + m, m)
	ans %= MOD
print(ans)


(n, m) = map(int, input().split())
mat = [[0] * m for i in range(n + 1)]
for i in range(1, n + 1):
	mat[i][0] = i * (i + 1) // 2
	for j in range(1, m):
		mat[i][j] = mat[i][j - 1] + mat[i - 1][j] + mat[i - 1][j] - mat[i - 2][j]
print(mat[n][m - 1] % (10 ** 9 + 7))


mod = 10 ** 9 + 7

def comb(n, r):
	(num, den) = (1, 1)
	for i in range(1, r + 1):
		den *= i
	for i in range(n, n - r, -1):
		num *= i
	return num // den
(n, m) = map(int, input().split())
ans = comb(n + 2 * m - 1, 2 * m)
print(ans % mod)


from math import factorial as fact
(n, m) = map(int, input().split())
mod = 1000000007
n1 = n + 2 * m - 1
r = 2 * m
ans = fact(n1) // (fact(r) * fact(n1 - r))
print(ans % mod)


from math import factorial
(n, m) = map(int, input().split())
t = pow(10, 9) + 7
count = factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1))
print(count % t)


from math import factorial as fact

def C(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = map(int, input().split())
print(C(n + 2 * m - 1, 2 * m) % 1000000007)


from itertools import accumulate
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
var = [1] * n
for i in range(m - 1):
	var = list(accumulate(var))
lower = list(accumulate(var))
total = 0
for mid in range(n):
	total += var[mid] * lower[n - mid - 1]
print(total % mod)


(n, m) = map(int, input().split())
res = 0
p = 1
for i in range(m):
	p = p * (n + m - i - 1) // (i + 1)
for am in range(1, n + 1):
	res = (res + p) % (10 ** 9 + 7)
	p = p * (m + am - 1) // am * (n - am) // (n - am + m)
print(res)


import sys
import math
t = 1
mod = 10 ** 9 + 7
while t:
	(n, m) = map(int, input().split())
	ans = math.factorial(n + 2 * m - 1) // (math.factorial(2 * m) * math.factorial(n - 1)) % mod
	print(ans)
	t -= 1


import operator as op
from functools import reduce
(n, m) = map(int, input().split())
MOD = 1000000007

def ncr(cn, r):
	if r > cn:
		return 0
	r = min(r, cn - r)
	numer = reduce(op.mul, range(cn, cn - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
ans = 0
for i in range(1, min(2 * m + 1, n + 1)):
	a1 = ncr(n, i)
	a2 = ncr(2 * m - 1, i - 1)
	ans = (ans + a1 * a2 % MOD) % MOD
print(int(ans % MOD))


from math import factorial
(n, m) = [int(x) for x in input().split()]
M = 10 ** 9 + 7
print(factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1)) % M)


(n, m) = map(int, input().split())
ans = 1
mod = 10 ** 9 + 7
x = n + 2 * m - 1
while x > n - 1:
	ans *= x
	x -= 1
x = 1
while x <= 2 * m:
	ans //= x
	x += 1
print(ans % mod)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
inv = [0] * 100
inv[1] = 1
for i in range(2, 26):
	inv[i] = (mod - mod // i * inv[mod % i] % mod) % mod
b = n
for i in range(1, 2 * m):
	b = b * (n + i) % mod * inv[i + 1] % mod
print(b)


(n, m) = input().split()
n = int(n)
m = int(m)
mod = 1000000000 + 7
l = [[0 for i in range(0, 1001)] for j in range(0, 11)]
for i in range(1, 1001):
	l[0][i] = 1
for i in range(1, 11):
	for j in range(1, 1001):
		l[i][j] = (l[i - 1][j] % mod + l[i][j - 1] % mod) % mod
b = list()
a = list()
for i in range(0, n + 1):
	b.append(0)
	a.append(0)
for i in range(1, n + 1):
	a[i] = l[m - 1][i]
for i in range(1, n + 1):
	b[i] = l[m][n + 1 - i]
for i in range(1, n + 1):
	b[i] = b[i] * a[i] % mod
sum1 = 0
for i in range(1, n + 1):
	sum1 = (sum1 + b[i]) % mod
print(sum1)


inputs = list(map(int, input().split()))
(n, m) = (inputs[0], 2 * inputs[1])
from math import factorial
print(factorial(n + m - 1) // (factorial(n - 1) * factorial(m)) % (10 ** 9 + 7))


import os
import sys
from io import BytesIO, IOBase
import math
mod = int(1000000000.0 + 7)

def main():
	(n, m) = map(int, input().split(' '))
	n = n + 2 * m - 1
	m = 2 * m
	ans = 1
	for x in range(m):
		ans = ans * n
		n = n - 1
	print(ans // math.factorial(m) % mod)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


MOD = 10 ** 9 + 7
(n, m) = map(int, input().split())
pre = []
ss = [0] * (n + 1)
s = [0] + [1] * n
pre.append(ss)
pre.append(s)
for i in range(2, m + 1):
	h = [0]
	for j in range(1, n + 1):
		h.append((pre[i - 1][j] + h[-1]) % MOD)
	pre.append(h)
arr = pre[m]
dp = [arr[0]]
for i in range(1, len(arr)):
	dp.append((dp[-1] + arr[i]) % MOD)
ans = 0
ptr = len(dp) - 1
for i in range(1, len(arr)):
	ans = (ans + arr[i] * dp[ptr] % MOD) % MOD
	ptr = (ptr - 1) % MOD
print(ans % MOD)


import math
(n, m) = map(int, input().split())
r = 1000000007
a = math.factorial(n + 2 * m - 1)
b = math.factorial(2 * m) * math.factorial(n - 1)
a = a // b
print(a % r)


from math import factorial as fact
mod = 10 ** 9 + 7

def C(n, r):
	if n - r >= 0 and r >= 0:
		return fact(n) // (fact(r) * fact(n - r))
	return 0
(n, m) = map(int, input().split())
print(C(2 * m + n - 1, n - 1) % mod)


import time, math
from sys import stdin, stdout

def I():
	return int(stdin.readline())

def In():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def Si():
	return sorted(list(map(int, stdin.readline().split())))

def Si():
	return sorted(list(map(int, stdin.readline().split())), reverse=True)

def P(x):
	return stdout.write(str(x) + '\n')

def Pi(x, y):
	return stdout.write(str(x) + ' ' + str(y) + ' ')

def solve():
	(n, m) = In()
	P(math.factorial(n + 2 * m - 1) // (math.factorial(2 * m) * math.factorial(n - 1)) % 1000000007)
solve()


def prodTree(l, r):
	if l > r:
		return 1
	if l == r:
		return l
	if r - l == 1:
		return l * r
	m = int((l + r) // 2)
	return prodTree(l, m) * prodTree(m + 1, r)

def factorial(n):
	if n < 0:
		return False
	if n == 0:
		return 1
	if n == 1 and n == 2:
		return n
	return prodTree(2, n)
(n, m) = [int(i) for i in input().split()]
print(factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1)) % int(1000000000.0 + 7))


pri = 10 ** 9 + 7
fact = [0 for i in range(10 ** 4 + 1)]
fact[0] = 1
fact[1] = 1
for i in range(2, len(fact)):
	fact[i] = i * (fact[i - 1] % pri) % pri
ifact = [0 for i in range(10 ** 4 + 1)]
ifact[1] = 1
ifact[0] = 1

def mod(a, y, pri):
	if y == 0:
		return 1
	else:
		p = mod(a, y // 2, pri) % pri
		p = p * p % pri
		if y % 2 == 0:
			return p
		else:
			return a * p % pri
for i in range(2, 10 ** 4 + 1):
	ifact[i] = ifact[i - 1] * mod(i, pri - 2, pri) % pri

def NcR(n, r):
	ret = ifact[n - r] * ifact[r] % pri
	ret = ret * fact[n] % pri
	return ret
(n, m) = map(int, input().split())
print(NcR(n + 2 * m - 1, n - 1))


def number(save, m, n):
	if save[m - 1][n - 1] == 0:
		k = 0
		for i in range(n, 0, -1):
			k += number(save, m - 1, i)
		save[m - 1][n - 1] = k
		return k
	else:
		return save[m - 1][n - 1]
(n, m) = input().split()
(n, m) = (int(n), int(m))
save = [[0 for column in range(n)] for row in range(m - 1)]
save.insert(0, [i for i in range(1, n + 1)])
for i in range(1, m):
	save[i][0] = 1
number(save, m, n)
(k, count) = (0, 0)
for i in range(n, 0, -1):
	if m == 1:
		count += i % (10 ** 9 + 7)
	else:
		k += save[m - 2][n - i]
		count += save[m - 2][i - 1] * k % (10 ** 9 + 7)
print(count % (10 ** 9 + 7))


from math import factorial
(n, m) = map(int, input().split())

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))
print(ncr(n + 2 * m - 1, 2 * m) % (10 ** 9 + 7))


M = 1000000007
(n, m) = map(int, input().split())
arr = [[1] * n for x in range(m)]
for x in range(1, m):
	for y in range(1, n):
		arr[x][y] = (arr[x - 1][y] + arr[x][y - 1]) % M
cumsum = [arr[m - 1][0] for x in range(n)]
for x in range(1, n):
	cumsum[x] = (cumsum[x - 1] + arr[m - 1][x]) % M
ans = 0
i = 0
j = n - 1
while i < n:
	ans += arr[m - 1][j] * cumsum[i] % M % M
	j -= 1
	i += 1
print(ans % M)


(n, m) = map(int, input().split())
m = 2 * m
mod = 10 ** 9 + 7
dp = [[0] * (n + 1) for i in range(m + 1)]
for i in range(1, n + 1):
	dp[1][i] = 1
for i in range(2, m + 1):
	for j in range(1, n + 1):
		dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod
ans = 0
for i in range(n + 1):
	ans = (ans + dp[m][i]) % mod
print(ans)


MOD = 10 ** 9 + 7
MAX = 1019
fact = [1]
for zz in range(1, MAX + 1):
	fact.append(fact[-1] % MOD * zz % MOD % MOD)

def nCr(n, r):
	num = fact[n]
	den = fact[r] % MOD * (fact[n - r] % MOD) % MOD
	return num % MOD * pow(den, MOD - 2, MOD) % MOD
(n, m) = [int(x) for x in input().split()]
ans = nCr(n + 2 * m - 1, 2 * m)
print(ans)


mod = 10 ** 9 + 7

def fact(n):
	if n:
		return n * fact(n - 1)
	return 1

def C(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = map(int, input().split())
print(C(n + 2 * m - 1, 2 * m) % mod)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
f = [1]
for i in range(1, 20):
	f.append(i * f[-1])

def choose(n, k):
	return f[n] // f[n - k] // f[k]
(n, m) = rints()
M = 10 ** 9 + 7
dp = [[0] * n for _ in range(m)]
dp[0] = [1] * n
for i in range(1, m):
	s = 0
	for j in range(n):
		s += dp[i - 1][j]
		dp[i][j] = s
dpi = dp[-1]
dppref = [0] * n
dppref[0] = dpi[0]
for i in range(1, n):
	dppref[i] = dppref[i - 1] + dpi[i]
p = 0
for i in range(n):
	p += dpi[i] * dppref[n - 1 - i]
print(p % M)


def num():
	return int(input())

def line():
	return map(int, input().split())
from itertools import repeat
from math import factorial as fact

def f(n, m):
	return fact(n + 2 * m - 1) // fact(2 * m) // fact(n - 1)
(n, m) = line()
M = 10 ** 9 + 7
print(f(n, m) % M)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
(n, m) = map(int, input().split())
print(ncr(n + 2 * m - 1, 2 * m, mod))


MOD = 10 ** 9 + 7
f = [1]
for i in range(1020):
	f.append(f[-1] * (i + 1) % MOD)

def nCr(n, r, mod=MOD):
	return f[n] * pow(f[r], mod - 2, mod) * pow(f[n - r], mod - 2, mod) % mod
(n, m) = map(int, input().split())
ans = nCr(n + 2 * m - 1, 2 * m)
print(ans)


import math

def nCr(n, r):
	ans = math.factorial(n) // (math.factorial(r) * math.factorial(n - r))
	return ans

def main():
	(n, m) = map(int, input().split(' '))
	d = nCr(n + 2 * m - 1, 2 * m)
	d %= 10 ** 9 + 7
	print(d)
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a
N = 100000
mod = 10 ** 9 + 7
fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
	fac.append(fac[-1] * i % mod)
	inv.append(mod - inv[mod % i] * (mod // i) % mod)
	finv.append(finv[-1] * inv[-1] % mod)

def comb(n, r):
	if n < r:
		return 0
	else:
		return fac[n] * (finv[r] * finv[n - r] % mod) % mod

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	(n, m) = sep()
	ans = 0
	for r1 in range(1, n + 1):
		r2 = n - r1 + 1
		ans += comb(m - 1 + r1 - 1, r1 - 1) * comb(m + r2 - 1, r2 - 1)
		ans %= mod
	print(ans)
solve()


mod = 10 ** 9 + 7
(n, m) = list(map(int, input().split(' ')))

def fact(n):
	res = 1
	while n > 1:
		res *= n
		n -= 1
	return res

def C(n, m):
	return fact(n) // (fact(m) * fact(n - m))

def H(n, m):
	return C(n + m - 1, m)
print(H(n, 2 * m) % mod)


from math import factorial

def c(n, r):
	return factorial(n) // factorial(n - r) // factorial(r)
a = input().split()
n = int(a[0])
m = int(a[1])
MOD = 10 ** 9 + 7
ans = 0
for i in range(1, n + 1):
	x = c(m + i - 1, m) % MOD
	y = c(m + n - i - 1, m - 1) % MOD
	ans = (x * y + ans) % MOD
print(int(ans))


import sys, math, cmath
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
for tt in range(t):
	(n, m) = invr()
	print(math.factorial(n + 2 * m - 1) // (math.factorial(n - 1) * math.factorial(2 * m)) % 1000000007)


from math import comb
(n, m) = map(int, input().split())
print(comb(n + 2 * m - 1, 2 * m) % (10 ** 9 + 7))


from math import factorial as fact
s = input().split()
n = int(s[0])
m = int(s[1])
C = fact(2 * m + n - 1) // (fact(n - 1) * fact(2 * m))
print(C % (10 ** 9 + 7))


import math
import sys

def get_single_int():
	return int(sys.stdin.readline().strip())

def get_string():
	return sys.stdin.readline().strip()

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, m) = get_ints()
print(math.comb(n + 2 * m - 1, 2 * m) % (10 ** 9 + 7))


(n, m) = map(int, input().split(' '))
dp = [[0] * (n + 1) for _ in range(2 * m + 1)]
dp[1] = [0] + [1] * n
mm = 1000000007
for j in range(2, 2 * m + 1):
	dp[j] = [a % mm for a in dp[j - 1]]
	for i in range(n - 1, 0, -1):
		dp[j][i] = (dp[j][i + 1] % mm + dp[j - 1][i] % mm) % mm
print(sum(dp[2 * m]) % mm)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
(n, m) = map(int, input().split())
print(factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1)) % mod)


M = 1000000007
fact = [1] * 1050
for i in range(1, 1050):
	fact[i] = fact[i - 1] * i
	fact[i] %= M

def comb(n, r):
	return fact[n] * pow(fact[n - r], M - 2, M) * pow(fact[r], M - 2, M) % M
(n, m) = map(int, input().split())
print(comb(n + 2 * m - 1, 2 * m))


mod = int(1000000000.0 + 7)
(n, m) = map(int, input().split())

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans = ans * i % mod
	return ans

def modinv(a, m):

	def egcd(a, b):
		if a == 0:
			return (b, 0, 1)
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)
	(g, x, y) = egcd(a, m)
	return x % m
num = fact(n + 2 * m - 1)
den = fact(2 * m) * fact(n - 1) % mod
print(num * modinv(den, mod) % mod)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

class Combinatorics:

	def __init__(self, mx_sz):
		self.max_size = mx_sz
		self.fact = [1 for i in range(mx_sz)]
		self.inv_fact = [1 for i in range(mx_sz)]
		self.inv = [1 for i in range(mx_sz)]
		for i in range(2, mx_sz):
			self.inv[i] = mod - mod // i * self.inv[mod % i] % mod
			self.fact[i] = self.fact[i - 1] * i % mod
			self.inv_fact[i] = self.inv_fact[i - 1] * self.inv[i] % mod

	def C(self, n, k):
		if n < k:
			return 0
		return self.fact[n] * self.inv_fact[k] % mod * self.inv_fact[n - k] % mod

def main():
	(n, m) = list(map(int, input().split()))
	c = Combinatorics(n + 2 * m)
	ret = c.C(n + 2 * m - 1, 2 * m)
	print(ret)
main()


import math
n = input()
n = n.split(' ')
m = int(n[1])
n = int(n[0])
a = n + 2 * m - 1
b = n - 1
c = 2 * m
result = math.factorial(a) // (math.factorial(b) * math.factorial(c))
result = result % (10 ** 9 + 7)
print(result)


(n, m) = map(int, input().split())
ans = [[0] * (m + 1) for i in range(n + 1)]
for i in range(1, n + 1):
	ans[i][0] = ans[i - 1][0] + i
for j in range(1, m + 1):
	for i in range(n + 1):
		for k in range(i + 1):
			ans[i][j] += ans[i - k][j - 1] * (k + 1)
		ans[i][j] %= 10 ** 9 + 7
print(ans[n][m - 1])


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	(n, m) = sep()
	print(ncr(2 * m + n - 1, 2 * m) % mod)
testcase(1)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
mem = {}

def cnk(n, k):
	if (n, k) in mem:
		return mem[n, k]
	if n == 0:
		mem[n, k] = k == 0
	elif k == 0:
		mem[n, k] = 1
	else:
		mem[n, k] = (cnk(n - 1, k) + cnk(n - 1, k - 1)) % mod
	return mem[n, k]
print(cnk(n + 2 * m - 1, n - 1))


import math

def c(a, b):
	k = int(1)
	a = int(a)
	b = int(b)
	if a > b:
		return 0
	if a < b // 2:
		a = int(b - a)
	for i in range(a + 1, b + 1):
		k *= i
	for i in range(1, b - a + 1):
		k = int(k // i)
	return k % int(1000000007)
(n, m) = map(int, input().split())
ans = int(0)
for i in range(1, m * 2 + 1):
	ans += c(int(i), int(n)) * c(int(i - int(1)), int(m * 2 - int(1)))
	ans %= int(1000000007)
print(ans)


(n, m) = map(int, input().split())
mod = int(1000000000.0 + 7)
memo = {}

def p(n, k):
	if n == 0 or k == 0 or k == n:
		return 1
	if (n, k) not in memo:
		memo[n, k] = (p(n - 1, k - 1) + p(n - 1, k)) % mod
	return memo[n, k]
print(p(n + m * 2 - 1, n - 1))


from math import factorial as fact
mod = 10 ** 9 + 7
(n, m) = [int(x) for x in input().split(' ')]
a = n + 2 * m - 1
b = 2 * m
print(fact(a) // fact(b) // fact(a - b) % mod)


N = 1100
dp = [[-1 for c in range(N)] for r in range(N)]
MOD = 10 ** 9 + 7

def ncr(n, r):
	if n < r:
		return 0
	if n == r or r == 0:
		return 1
	if dp[n][r] != -1:
		return dp[n][r]
	dp[n][r] = ncr(n - 1, r) + ncr(n - 1, r - 1)
	if dp[n][r] >= MOD:
		dp[n][r] -= MOD
	return dp[n][r]

def solve(n, m):
	print(ncr(n=n + 2 * m - 1, r=2 * m))
while True:
	try:
		(n, d) = map(int, input().split())
		solve(n, d)
	except EOFError:
		break


(n, m) = map(int, input().split())

def fact(num):
	f = 1
	if num != 0:
		while num != 1:
			f = f * num
			num -= 1
		return f
	else:
		return 1
a = n + 2 * m - 1
b = n - 1
c = a - b
ans = fact(a) // (fact(b) * fact(c))
mod = 10 ** 9 + 7
print(ans % mod)


mo = 10 ** 9 + 7
from math import factorial as fuck
(n, m) = map(int, input().split())
a = fuck(n + 2 * m - 1)
a = a // fuck(n - 1)
a = a // fuck(2 * m)
print(a % mo)


m = 10 ** 9 + 7

def inv(k):
	return pow(k, m - 2, m)

def c(i, j):
	res = 1
	for t in range(j):
		res = res * (i - t) * inv(t + 1) % m
	return res
(a, b) = map(int, input().split())
print(c(a - 1 + 2 * b, 2 * b))


from math import comb
(n, m) = map(int, input().split())
print(comb(n + 2 * m - 1, 2 * m) % int(7 + 1000000000.0))


from math import *
(n, m) = map(int, input().split())
m = m * 2
x = factorial(n + m - 1)
y = factorial(n - 1)
z = factorial(m)
p = pow(10, 9) + 7
p = int(p)
ans = x // (y * z) % p
print(int(ans))


mod = 10 ** 9 + 7
from math import factorial

def func(n, c):
	return factorial(n) // (factorial(n - c) * factorial(c))
(a, b) = map(int, input().rstrip().split())
print(int(func(a + 2 * b - 1, 2 * b) % mod))


INF = 10 ** 10

def main():
	(n, m) = get_list()
	P = 10 ** 9 + 7
	dp = [[1] * m for _ in range(n)]
	for j in range(1, m):
		for i in range(1, n):
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % P
	k = 0
	res = 0
	for i in range(n):
		k = (k + dp[i][-1]) % P
		res = (res + k * dp[n - i - 1][-1] % P) % P
	print(res)
import sys
import math
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
main()


(n, m) = map(int, input().split())
m = 2 * m
n = n + m - 1
a = [(m + 1) * [0] for x in range(n + 1)]
for i in range(1, n + 1):
	a[i][1] = i
	if i <= m:
		a[i][i] = 1
for nn in range(3, n + 1):
	for mm in range(2, min(nn, m + 1)):
		a[nn][mm] = (a[nn - 1][mm] + a[nn - 1][mm - 1]) % (10 ** 9 + 7)
print(a[n][m])


import traceback
import math
from collections import defaultdict
from functools import lru_cache

def main():
	(N, M) = map(int, input().split())
	mod = 10 ** 9 + 7

	def fact(n):
		return math.factorial(n)
	ans = fact(N + 2 * M - 1) // (fact(2 * M) * fact(N - 1)) % mod
	return int(ans)
try:
	ans = main()
	print(ans)
except Exception as e:
	print(e)
	traceback.print_exc()


hell = 1000000007

def binpow(a, b, mod):
	if b == 0:
		return 1
	t = binpow(a, b // 2, mod)
	if b % 2 == 1:
		return a * t % mod * t % mod
	return t * t % mod

def ncr(n, r):
	if r > n:
		return 0
	r = min(r, n - r)
	num = 1
	for i in range(n - r + 1, n + 1):
		num *= i
	den = 1
	for i in range(1, r + 1):
		den *= i
	return num * binpow(den, hell - 2, hell) % hell

def meowmeow321():
	(n, m) = map(int, input().split())
	print(ncr(n + 2 * m - 1, n - 1))
t = 1
for a in range(t):
	meowmeow321()


from math import factorial as fact
(n, m) = [int(i) for i in input().split()]
mod = 1000000007
a = fact(n + 2 * m - 1)
b = fact(2 * m)
c = fact(n - 1)
b = b * c
a = a // b
print(a % mod)


def fac(n):
	x = 1
	for i in range(1, n + 1):
		x *= i
	return x
(n, m) = list(map(int, input().split(' ')))
x = fac(n + 2 * m - 1)
y = fac(2 * m)
z = fac(n - 1)
print(x // (y * z) % 1000000007)


from math import factorial as fact

def comb(a, b):
	return fact(a + 2 * b - 1) // (fact(a - 1) * fact(2 * b))
mod = 1000000007
(n, m) = map(int, input().split(' '))
num = comb(n, m)
print(num % mod)


def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
(n, m) = map(int, input().split())
print(ncr(2 * m + n - 1, n - 1, 10 ** 9 + 7))


def solve(n, m):
	mod = 10 ** 9 + 7
	dp = [[0] * n for i in range(2 * m)]
	for i in range(n):
		dp[0][i] = 1
	for i in range(1, 2 * m):
		sum = 0
		for j in range(n):
			sum += dp[i - 1][j]
			sum %= mod
			dp[i][j] = sum
	ans = 0
	for j in range(len(dp[2 * m - 1])):
		ans += dp[2 * m - 1][j]
		ans %= mod
	return ans
inp = input().strip().split()
A = int(inp[0])
B = int(inp[1])
print(solve(A, B))


from math import factorial as fact
mo = 10 ** 9 + 7

def c(n, k):
	return fact(n) // (fact(n - k) * fact(k))
(a, b) = map(int, input().split())
print(c(2 * b + a - 1, 2 * b) % mo)


from math import *
MOD = 10 ** 9 + 7

def comb(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
(n, m) = [int(x) for x in input().split()]
print(comb(n + 2 * m - 1, 2 * m) % MOD)


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
modulo = 10 ** 9 + 7
(n, m) = map(int, input().split())
D = [1] * n
for l in range(m - 1):
	leftSum = 0
	for i in range(n):
		leftSum += D[i]
		D[i] = leftSum % modulo
ans = 0
for i in range(n):
	for j in range(i, n):
		ctrA = D[i]
		ctrB = D[n - 1 - j]
		ans += ctrA * ctrB % modulo
		ans %= modulo
print(ans)


import math
(n, m) = input().split()
(m, n) = (int(m), int(n))
out = int(math.factorial(n + 2 * m - 1) // (math.factorial(2 * m) * math.factorial(n - 1)))
out = out % (10 ** 9 + 7)
print(out)


def fact(n):
	dp = [0 for i in range(n + 1)]
	dp[0] = 1
	for i in range(1, n):
		dp[i] = i * dp[i - 1]
	return dp
(n, m) = map(int, input().split())
factorial = []
x = n + 2 * m - 1 + 5
factorial = fact(x)
mod = 10 ** 9 + 7
(a, b, c) = (factorial[n + 2 * m - 1], factorial[2 * m], factorial[n - 1])
y = a // (b * c)
print(int(y) % mod)


memo = [-1 for i in range(1100)]

def fac(q):
	if memo[q] != -1:
		return memo[q]
	memo[q] = q * fac(q - 1)
	return memo[q]
(n, m) = [int(x) for x in input().split()]
mod = 1000000007
memo[0] = 1
print(fac(2 * m + n - 1) // (fac(2 * m) * fac(n - 1)) % mod)


mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
fact = [1]
for i in range(1, 2000):
	fact.append(fact[-1] * i % mod)
print(fact[n + 2 * m - 1] * pow(fact[n - 1] * fact[2 * m], mod - 2, mod) % mod)


import os
import sys
from atexit import register
from io import StringIO
sys.stdout = StringIO()
register(lambda : os.write(1, sys.stdout.getvalue().encode()))
import math
MOD = int(1000000000.0 + 7)
(n, m) = [int(k) for k in input().split()]
dp = {}

def solve(size, cap):
	key = (size, cap)
	if key in dp:
		return dp[key]
	if size == 0:
		dp[key] = 1
		return dp[key]
	elif size == 1:
		dp[key] = cap
		return dp[key]
	else:
		ret = 0
		for i in range(1, cap + 1):
			ret = (ret + solve(size - 1, i)) % MOD
		dp[key] = ret
		return dp[key]
for i in range(m):
	for j in range(n):
		solve(m, n)
ret = 0
for i in range(1, n + 1):
	for j in range(i, n + 1):
		k = solve(m - 1, i) * solve(m - 1, n + 1 - j) % MOD
		ret = (ret + k) % MOD
print(ret)


mo = 10 ** 9 + 7

def fac(n):
	if n == 0:
		return 1
	return fac(n - 1) * n
(n, m) = map(int, input().split())
print(fac(n + m + m - 1) // (fac(m + m) * fac(n - 1)) % mo)


mod = [10 ** 9 + 7]

def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
		ans %= mod[0]
	return ans
(n, m) = map(int, input().split())
val = fact(n + 2 * m - 1)
val *= pow(fact(n - 1), mod[0] - 2, mod[0])
val %= mod[0]
val *= pow(fact(2 * m), mod[0] - 2, mod[0])
val %= mod[0]
print(val)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
(n, m) = rints()

def f(n):
	return 1 if n <= 1 else n * f(n - 1)
print(f(n + 2 * m - 1) // f(n - 1) // f(2 * m) % (10 ** 9 + 7))


(n, m) = map(int, input().strip().split())
(a, b) = (n + 2 * m - 1, 2 * m)
res = 1
for i in range(a - b + 1, a + 1):
	res *= i
for i in range(1, b + 1):
	res //= i
print(res % (10 ** 9 + 7))


from sys import stdin
input = stdin.readline
fact = [1]
mod = 10 ** 9 + 7
revm = [1]

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
for i in range(1, 1001):
	fact.append(fact[-1] % mod * i % mod)
	revm.append(modInverse(fact[i], mod))
(n, m) = map(int, input().split())
a = []
b = []
t3 = 0
for i in range(min(2 * m, n)):
	t1 = fact[2 * m - 1] * (revm[2 * m - 1 - i] % mod) % mod * (revm[i] % mod) % mod
	t2 = fact[n] * (revm[n - i - 1] % mod) % mod * revm[i + 1] % mod % mod
	t3 = (t1 % mod * (t2 % mod) % mod + t3 % mod) % mod
print(t3)


def binom(n, k):
	r = 1
	for i in range(1, k + 1):
		r *= n + 1 - i
		r //= i
	return r
MOD = 10 ** 9 + 7
nm = input().split()
(n, m) = (int(nm[0]), int(nm[1]))
ans = 0
for k in range(1, n + 1):
	a = binom(k + m - 2, m - 1) % MOD
	b = binom(n - k + 1 + m - 1, m) % MOD
	ans += a * b
	ans %= MOD
print(ans)


from sys import stdin, stdout
from sys import maxsize
input = stdin.readline
val = 10 ** 9 + 7

def solve():
	pass

def fact(a, b):
	ans = 1
	for i in range(b + 1, a + 1):
		ans *= i
		ans % val
	return ans % val
test = 1
for t in range(0, test):
	(n, m) = list(map(int, input().strip().split()))
	a = 2 * m + n - 1
	b = max(2 * m, n - 1)
	print(fact(a, b) * pow(fact(a - b, 1), val - 2, val) % val)
	ans = solve()


M = 10 ** 9 + 7

def fact(n):
	a = 1
	for i in range(2, n + 1):
		a = a * i % M
	return a
(n, m) = [int(x) for x in input().split()]
a = fact(n + 2 * m - 1)
b = fact(2 * m) * fact(n - 1) % M
b = pow(b, M - 2, M)
print(a * b % M)


import sys
mod = 10 ** 9 + 7

def power(x, y, m):
	if y == 0:
		return 1
	p = power(x, y // 2, m)
	p = p * p % m
	if y & 1:
		p = p * x % m
	return p

def modinverse(a, m):
	return power(a, m - 2, m)
fact = [1]
for i in range(1, 1500):
	fact.append(i * fact[-1] % mod)
(n, m) = map(int, sys.stdin.readline().split())
(a, b) = (modinverse(fact[2 * m], mod), modinverse(fact[n - 1], mod))
print(fact[n + 2 * m - 1] * modinverse(fact[2 * m], mod) * modinverse(fact[n - 1], mod) % mod)


(n, m) = list(map(int, input().split()))

def c(n, r):
	res = 1
	if r > n - r:
		r = n - r
	for i in range(0, r):
		res = res * (n - i)
		res = res // (i + 1)
	return res
ans = c(n + 2 * m - 1, 2 * m) % 1000000007
print(ans)


mod = int(1000000000.0) + 7
(n, m) = map(int, input().strip().split())
dp = [[0 for i in range(m + 1)] for i in range(n + 1)]
for i in range(1, n + 1):
	dp[i][0] = 1
for i in range(1, n + 1):
	for j in range(1, m + 1):
		total = 0
		for k in range(i, 0, -1):
			total += dp[k][j - 1] % mod
		dp[i][j] = (dp[i - 1][j] + total) % mod
print(dp[n][m])


def fact(k):
	fa = 1
	for i in range(1, k + 1):
		fa = i * fa
	return fa
(n, m) = map(int, input().split())
a = fact(n + 2 * m - 1)
b = fact(2 * m)
c = fact(n - 1)
ans = 0
ans = a // (b * c)
print(ans % 1000000007)


(n, m) = map(int, input().split())
N = n + 2 * m - 1
R = 2 * m
res1 = 1
res2 = 1
mo = 10 ** 9 + 7
while R > 0:
	res1 *= N
	res2 *= R
	R -= 1
	N -= 1
ans = res1 // res2
print(ans % mo)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, m) = zzz()
t = f(n + 2 * m - 1)
y = f(2 * m)
p = f(n - 1)
print(t // (y * p) % mod)


(n, m) = map(int, input().split(' '))
dp1 = [1] * n
for t in range(2 * m - 1):
	dp2 = [0] * n
	for i in range(n):
		dp2[i] = sum(dp1[:i + 1])
	dp1 = dp2
print(sum(dp1) % (10 ** 9 + 7))


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
a = [[] for i in range(m + 1)]
for i in range(m + 1):
	a[i] = [0 for j in range(n + 1)]
for i in range(1, n + 1):
	a[1][i] = 1
for l in range(2, m + 1):
	s = 0
	for last in range(1, n + 1):
		s += a[l - 1][last]
		s = s % mod
		a[l][last] = s
b = [[] for i in range(m + 1)]
for i in range(m + 1):
	b[i] = [0 for j in range(n + 1)]
for i in range(1, n + 1):
	b[1][i] = 1
for l in range(2, m + 1):
	s = 0
	for last in range(n, 0, -1):
		s += b[l - 1][last]
		s = s % mod
		b[l][last] = s
s = 0
for i in range(1, n + 1):
	s += b[m][i]
	s = s % mod
ans = 0
for i in range(1, n + 1):
	ans += a[m][i] * s
	ans %= mod
	s -= b[m][i]
	s %= mod
print(ans)


(n, m) = map(int, input().split())
dp_a = [[0] * n for _ in range(m)]
dp_b = [[0] * n for _ in range(m)]
for i in range(n):
	dp_a[0][i] = 1
for i in range(1, m):
	for j in range(n):
		dp_a[i][j] = (dp_a[i - 1][j] + dp_a[i][j - 1]) % (10 ** 9 + 7)
for i in range(m):
	for j in range(n):
		dp_b[i][j] = (dp_b[i][j - 1] + dp_a[i][j]) % (10 ** 9 + 7)
count = 0
for i in range(n):
	try:
		count += dp_a[m - 1][i] * dp_b[m - 1][n - i - 1]
	except:
		continue
print(count % 1000000007)


import sys, math
import io, os

def data():
	return sys.stdin.buffer.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
mod = int(1000000000.0) + 7
(n, m) = mdata()
ans = 0
m *= 2
dp = [1] * (n * m + 1)
for i in range(1, n + m):
	dp[i] = dp[i - 1] * i % mod
ans = dp[n + m - 1] * pow(dp[m] * dp[n - 1], mod - 2, mod) % mod
out(ans)


import sys
import bisect as b
input = sys.stdin.readline
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
dp = [[-1] * 1001 for i in range(21)]

def solve(i, last, n, m):
	if dp[i][last] != -1:
		return dp[i][last]
	if i == m:
		dp[i][last] = 1
		return 1
	ans = 0
	for j in range(last, n + 1):
		val = solve(i + 1, j, n, m)
		ans = (ans + val % mo) % mo
	dp[i][last] = ans
	return ans
(n, m) = cin()
m = m * 2
print(solve(0, 1, n, m))


import sys
MODULO = 10 ** 9 + 7

def get_monotonic_arr_num(n, m, ARR_NUM):
	if m == 0:
		return 1
	if ARR_NUM[n - 1][m - 1] > 0:
		return ARR_NUM[n - 1][m - 1]
	elif n == 1:
		ARR_NUM[n - 1][m - 1] = 1
	elif m == 1:
		ARR_NUM[n - 1][m - 1] = n
	else:
		total = 0
		for i in range(1, n + 1):
			total += get_monotonic_arr_num(i, m - 1, ARR_NUM) % MODULO
		ARR_NUM[n - 1][m - 1] = total % MODULO
	return ARR_NUM[n - 1][m - 1]

def get_increasing_arr_num(i, m, ARR_NUM):
	return get_monotonic_arr_num(i, m - 1, ARR_NUM)

def get_decreasing_arr_num(n, i, m, ARR_NUM):
	return get_monotonic_arr_num(n - i + 1, m - 1, ARR_NUM)

def get_arr_num(n, m, ARR_NUM):
	total = 0
	for i in range(1, n + 1):
		increasing_num = get_increasing_arr_num(i, m, ARR_NUM)
		decreasing_num = get_decreasing_arr_num(n, i, m + 1, ARR_NUM)
		total += increasing_num * decreasing_num % MODULO
	return total % MODULO

def init_arr_num(n, m):
	ARR_NUM = []
	for i in range(0, n):
		ARR_NUM.append([0] * m)
	return ARR_NUM

def main():
	data = sys.stdin.readlines()
	line = data[0].split(' ')
	n = int(line[0])
	m = int(line[1])
	ARR_NUM = init_arr_num(n, m)
	print(get_arr_num(n, m, ARR_NUM))

def check(n, m, expected):
	ARR_NUM = init_arr_num(n, m)
	result = get_monotonic_arr_num(n, m, ARR_NUM)
	print(ARR_NUM)
	print(result, expected, result == expected)

def test():
	check(1, 1, 1)
	check(2, 1, 2)
	check(1, 2, 1)
	check(2, 2, 3)
main()


val = 10 ** 9 + 7

def bin_exp(a, n):
	if n == 0:
		return 1
	else:
		j = 0
		bin_val = []
		while n > 0:
			bin_val.append(n % 2)
			n = n // 2
			j += 1
		power_arr = [a % val]
		for i in range(1, j):
			power_arr.append(power_arr[-1] ** 2 % val)
		value = 1
		for i in range(0, j):
			if bin_val[i] == 1:
				value = value * power_arr[i] % val
		return value % val

def fact_arr(n):
	arr = [1]
	for i in range(n):
		arr.append(arr[-1] * (i + 1) % val)
	return arr

def mult_inver(a):
	return bin_exp(a, val - 2)
fact_list = fact_arr(10 ** 3)
inv_fact_list = [1]
for i in range(1, 10 ** 3 + 1):
	inv_fact_list.append(mult_inver(fact_list[i]))
(n, m) = input().split()
n = int(n)
m = int(m)
val1 = 0
for i in range(1, min(n, 2 * m) + 1):
	val1 = (val1 + fact_list[n] * inv_fact_list[i] * inv_fact_list[n - i] * fact_list[2 * m - 1] * inv_fact_list[i - 1] * inv_fact_list[2 * m - i]) % val
print(val1 % val)


mod = 10 ** 9 + 7
(n, m) = list(map(int, input().split()))
arr = [[0 for j in range(n)] for i in range(m)]
brr = [[0 for j in range(n)] for i in range(m)]
for i in range(m):
	for j in range(n):
		if i != 0:
			for k in range(j, -1, -1):
				arr[i][j] += arr[i - 1][k]
				arr[i][j] = arr[i][j] % mod
		else:
			arr[i][j] = 1
for i in range(m):
	for j in range(n):
		if i != 0:
			for k in range(j, n):
				brr[i][j] += brr[i - 1][k]
				brr[i][j] = brr[i][j] % mod
		else:
			brr[i][j] = 1
answer = 0
for i in range(n):
	for j in range(i, n):
		answer += arr[m - 1][i] % mod * (brr[m - 1][j] % mod) % mod
		answer = answer % mod
print(answer)


def solve(n, m):
	m *= 2
	answer = 1
	for i in range(m):
		answer = answer * (n + i) // (i + 1)
	print(answer % 1000000007)
(n, m) = map(int, input().split())
solve(n, m)


def fact(x):
	hz = 1
	while x >= 1:
		hz *= x
		x -= 1
	return hz
(n, m) = list(map(int, input().split()))
hz = fact(2 * m) * fact(n - 1)
print(fact(n + m * 2 - 1) // hz % (10 ** 9 + 7))


import math
MOD = 10 ** 9 + 7
(n, m) = map(int, input().split(' '))
ans = math.factorial(n + 2 * m - 1) // (math.factorial(2 * m) * math.factorial(n - 1)) % MOD
print(ans)


import math
mod = int(1000000000.0 + 7)
fact = lambda x: math.factorial(x)
(n, m) = tuple(map(int, input().split()))
print(fact(2 * m + n - 1) // (fact(n - 1) * fact(2 * m)) % mod)


from math import *

def comb(n, m):
	return factorial(n) // (factorial(m) * factorial(n - m))
(n, m) = map(int, input().split())
print(comb(n + 2 * m - 1, 2 * m) % 1000000007)


(n, m) = map(int, input().split())
dp1 = [[0] * (m + 1) for i in range(n + 1)]
dp2 = [[0] * (m + 1) for i in range(n + 1)]
M = 10 ** 9 + 7
for j in range(1, m + 1):
	dp1[1][j] = 1
for i in range(1, n + 1):
	dp1[i][1] = 1
for i in range(2, n + 1):
	for j in range(2, m + 1):
		dp1[i][j] = dp1[i - 1][j] + dp1[i][j - 1]
sums1 = 0
psum1 = [0] * (n + 1)
for i in range(1, n + 1):
	sums1 += dp1[i][m]
	psum1[i] = sums1
for i in range(1, n + 1):
	dp2[i][j] = 1
for j in range(1, m + 1):
	dp2[n][j] = 1
for i in range(n - 1, 0, -1):
	for j in range(1, m + 1):
		dp2[i][j] = dp2[i + 1][j] + dp2[i][j - 1]
sums2 = 0
psum2 = [0] * (n + 1)
for i in range(n, 0, -1):
	sums2 += dp2[i][m]
	psum2[i] = sums2
sums = 0
for i in range(1, n + 1):
	sums = sums % M + dp2[i][m] % M * (psum1[i] % M) % M
print(sums % M)


fac = [1 for _ in range(1021)]
ifac = [1 for _ in range(1021)]
mod = 10 ** 9 + 7

def ModInv(x, y):
	res = 1
	while y > 0:
		if y & 1:
			res = res * x % mod
		y = y >> 1
		x = x * x % mod
	return res
for i in range(1, 1020):
	fac[i] = fac[i - 1] * i % mod
	ifac[i] = ifac[i - 1] * ModInv(i, mod - 2) % mod
for _ in range(1):
	(n, m) = map(int, input().split())
	ans = fac[n + 2 * m - 1] * (ifac[2 * m] * ifac[n - 1]) % mod % mod
	print(ans)


(n, m) = map(int, input().split())
a = [[0 for j in range(n)] for i in range(m)]
for i in range(n):
	a[0][i] = 1
for i in range(m):
	a[i][0] = 1
for i in range(1, m):
	for j in range(1, n):
		a[i][j] = a[i - 1][j] + a[i][j - 1]
b = [[0 for j in range(n)] for i in range(m)]
for i in range(m):
	for j in range(n):
		b[i][j] = a[i][n - j - 1]
s = sum(a[m - 1])
cnt = 0
for i in range(n):
	cnt += a[m - 1][i] * s
	cnt %= 1000000007
	s -= b[m - 1][i]
print(cnt)


import math
from collections import Counter
from math import factorial as fact

def inpint():
	return int(input())

def inpstr():
	return str(input())

def inparr():
	return list(map(int, input().strip().split()))

def inptup():
	return map(int, input().strip().split())
mod = 10 ** 9 + 7

def C(n, r):
	if r > n - r:
		r = n - r
	ans = 1
	for i in range(0, r, 1):
		ans *= n - i
		ans //= i + 1
	return int(ans)
(n, m) = inptup()
print(C(2 * m + n - 1, n - 1) % mod)


from math import comb as c
(n, m) = map(int, input().split())
print(c(n + 2 * m - 1, 2 * m) % 1000000007)


import math

def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problem1():
	t = inp(int)
	for _ in range(t):
		(n, d) = inp(int)
		res = False
		sq = math.floor(math.sqrt(d))
		for x in range(max(sq - 1000, 0), min(sq + 1000, n)):
			if x + math.ceil(d / (x + 1)) <= n:
				res = True
				break
		if res:
			print('YES')
		else:
			print('NO')

def problem2():
	t = inp(int)
	for _ in range(t):
		(A, B) = inp(int)
		res = 0
		len_b = 1
		while 10 ** len_b - 1 <= B:
			res += A
			len_b += 1
		print(res)

def problem3():
	(n, m) = inp(int)
	mod = 10 ** 9 + 7
	mat = [[0 for _ in range(n + 1)] for _ in range(m + 1)]
	for t in range(1, n + 1):
		mat[1][t] = 1
	for k in range(2, m + 1):
		for t in range(1, n + 1):
			for tt in range(1, t + 1):
				mat[k][t] += mat[k - 1][tt]
				mat[k][t] %= mod
	cum = [0 for _ in range(n + 1)]
	for t in range(1, n + 1):
		for tt in range(1, t + 1):
			cum[t] += mat[m][tt]
			cum[t] %= mod
	res = 0
	for t in range(1, n + 1):
		res += mat[m][t] * cum[n - t + 1]
		res %= mod
	print(res)

def problem4():
	pass

def problem5():
	pass

def problem6():
	pass
problem3()


from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	res = list(sys.stdin.readline())
	if res[-1] == '\n':
		return res[:-1]
	return res

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
	(n, m) = LI()
	f = [1]
	N = 10 ** 6
	for i in range(1, N + 1):
		f.append(f[-1] * i % mod)
	inv = [None] * (N + 1)
	inv[N] = pow(f[N], mod - 2, mod)
	for i in range(N)[::-1]:
		inv[i] = inv[i + 1] * (i + 1) % mod
	print(f[2 * m + n - 1] * inv[n - 1] * inv[2 * m] % mod)
	return

def __starting_point():
	solve()
__starting_point()


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, M):
	MOD = 10 ** 9 + 7
	ways = [1 for i in range(N)]
	for i in range(M - 1):
		nextWays = [0 for i in range(N)]
		for j in range(N):
			if j:
				nextWays[j] += nextWays[j - 1]
			nextWays[j] += ways[j]
			nextWays[j] %= MOD
		ways = nextWays
	ans = 0
	for i in range(N):
		for j in range(i, N):
			ans += ways[i] * ways[N - j - 1]
			ans %= MOD
	return ans % MOD
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N, M) = [int(x) for x in input().split()]
ans = solve(N, M)
print(ans)


class Combination:

	def __init__(self, n, MOD):
		self.fact = [1]
		for i in range(1, n + 1):
			self.fact.append(self.fact[-1] * i % MOD)
		self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]
		self.MOD = MOD

	def factorial(self, k):
		return self.fact[k]

	def inverse_factorial(self, k):
		return self.inv_fact[k]

	def permutation(self, k, r):
		if k < r:
			return 0
		return self.fact[k] * self.inv_fact[r] % self.MOD

	def combination(self, k, r):
		if k < r:
			return 0
		return self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r] % self.MOD
(n, m) = map(int, input().split())
MOD = 10 ** 9 + 7
comb = Combination(2 * n + m, MOD)
tmp = 0
for ai in range(1, n + 1):
	for bi in range(ai, n + 1):
		tmp += comb.combination(m - 1 + ai - 1, m - 1) * comb.combination(m - 1 + n - bi + 1 - 1, m - 1)
print(tmp % MOD)


def mod_exp(b, e, mod):
	r = 1
	while e > 0:
		if e & 1 == 1:
			r = r * b % mod
		b = b * b % mod
		e >>= 1
	return r

def fact_exp(n, p):
	e = 0
	u = p
	t = n
	while u <= t:
		e += t // u
		u *= p
	return e

def fermat_binom_advanced(n, k, p):
	num_degree = fact_exp(n, p) - fact_exp(n - k, p)
	den_degree = fact_exp(k, p)
	if num_degree > den_degree:
		return 0
	if k > n:
		return 0
	num = 1
	for i in range(n, n - k, -1):
		cur = i
		while cur % p == 0:
			cur //= p
		num = num * cur % p
	denom = 1
	for i in range(1, k + 1):
		cur = i
		while cur % p == 0:
			cur //= p
		denom = denom * cur % p
	return num * mod_exp(denom, p - 2, p) % p
mod = int(1000000000.0) + 7
(n, m) = map(int, input().split())
print(fermat_binom_advanced(n - 1 + 2 * m, 2 * m, mod))


import sys
from typing import List
sys.setrecursionlimit(100000)
_factorial_cache: List[int] = [1]
MOD = 10 ** 9 + 7

def factorial(_x: int) -> int:
	try:
		return _factorial_cache[_x]
	except IndexError:
		_factorial_cache.append(_x * factorial(_x - 1))
		return _factorial_cache[_x]
(n, m) = [int(i) for i in input().split()]
result = factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1))
print(result % MOD)


ma = 10 ** 9 + 7

def fact(n):
	if n == 0:
		return 1
	else:
		f = 1
		for i in range(1, n + 1):
			f = f * i
		return f

def combination(n, r):
	return fact(n) // (fact(n - r) * fact(r))
(n, m) = map(int, input().split())
print(combination(2 * m + n - 1, 2 * m) % ma)


inp = input()
n = int(inp.split(' ')[0])
m = int(inp.split(' ')[1])
nn = n - 1 + 2 * m
k = 2 * m
er = 1
for i in range(nn):
	er *= i + 1
for i in range(nn - k):
	er //= i + 1
for i in range(k):
	er //= i + 1
print(er % 1000000007)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class ModTools:

	def __init__(self, MAX, MOD):
		MAX += 1
		self.MAX = MAX
		self.MOD = MOD
		factorial = [1] * MAX
		factorial[0] = factorial[1] = 1
		for i in range(2, MAX):
			factorial[i] = factorial[i - 1] * i % MOD
		inverse = [1] * MAX
		inverse[MAX - 1] = pow(factorial[MAX - 1], MOD - 2, MOD)
		for i in range(MAX - 2, 0, -1):
			inverse[i] = inverse[i + 1] * (i + 1) % MOD
		self.fact = factorial
		self.inv = inverse

	def nCr(self, n, r):
		if n < r:
			return 0
		r = min(r, n - r)
		numerator = self.fact[n]
		denominator = self.inv[r] * self.inv[n - r] % self.MOD
		return numerator * denominator % self.MOD

	def nHr(self, n, r):
		return self.nCr(r + n - 1, r)
(N, M) = MAP()
mt = ModTools(N + M, MOD)
ans = 0
for k in range(N):
	a = mt.nHr(M, k)
	b = mt.nHr(N - k, M)
	ans += a * b
	ans %= MOD
print(ans)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7

def cmb1(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
mod = 10 ** 9 + 7
N = 10 ** 4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, N + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
r = 2 * m
ans = cmb1(n + r - 1, r, mod)
print(ans)


(n, m) = map(int, input().split())
k = n + m * 2 - 1
(fact, inv, factinv) = ([1, 1], [1, 1], [1])
mod = 1000000007
for i in range(2, k + 1):
	inv.append(0)
for i in range(2, k + 1):
	fact.append(i * fact[i - 1] % mod)
	inv[i] = inv[mod % i] * (mod - mod // i) % mod
for i in range(1, k + 1):
	factinv.append(inv[i] * factinv[i - 1] % mod)
print(fact[k] * factinv[2 * m] % mod * factinv[n - 1] % mod)


(n, m) = list(map(lambda x: int(x), input().split()))

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
mod = 1000000007
temp = ncr(n + m - 2, m - 1, mod)
total = temp
a = n + m - 2
b = m - 1
maximun = n
a_1 = m
b_1 = m
temp_2 = 1
for i in range(1, n):
	num = a - b
	den = a
	temp = temp * num % mod * pow(den, mod - 2, mod) % mod % mod
	a_1 += 1
	a -= 1
	num = a_1
	den = a_1 - m
	temp_2 = temp_2 * num % mod * pow(den, mod - 2, mod) % mod % mod
	total = (total + temp * temp_2 % mod) % mod
	maximun -= 1
print(total)


M = 10 ** 9 + 7
(n, m) = map(int, input().split())
f = [1]
for i in range(1, n + 2 * m):
	f += (f[-1] * i % M,)
print(f[-1] * pow(f[2 * m] * f[n - 1], M - 2, M) % M)


(n, m) = map(int, input().split())
matr = [[0 for j in range(m)] for i in range(n)]
for i in range(m):
	matr[0][i] = 1
(x, lst) = (1, [1])
for i in range(1, n):
	x += i + 1
	x = x % 1000000007
	matr[i][0] = x
	lst.append(x + lst[-1])
for i in range(1, m):
	lst1 = [1]
	app = lst1.append
	for j in range(1, n):
		matr[j][i] = (lst[j] + matr[j - 1][i]) % 1000000007
		app(matr[j][i] + lst1[-1])
	lst = lst1[:]
print(matr[n - 1][m - 1])


import math
(n, m) = input().split()
n = int(n)
m = int(m)
print(math.factorial(n + 2 * m - 1) // (math.factorial(n - 1) * math.factorial(2 * m)) % (1000000000 + 7))


from math import factorial as fact
mod = 10 ** 9 + 7

def func(x, y):
	return fact(x) // (fact(y) * fact(x - y))
(n, m) = [int(ele) for ele in input().split()]
result = func(2 * m + n - 1, 2 * m) % mod
print(result)


from sys import stdin, stdout

def getsatisfyingnumbers(n, m):
	MOD = 1000000007
	dp = [[0 for j in range(n + 1)] for i in range(m + 1)]
	for i in range(1, m + 1):
		dp[i][1] = 1
		for j in range(2, n + 1):
			dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD
	dp2 = [[0 for j in range(n + 1)] for i in range(m + 1)]
	for i in range(1, m + 1):
		dp2[i][n] = 1
		for j in range(n - 1, 0, -1):
			dp2[i][j] = (dp2[i - 1][j] + dp2[i][j + 1]) % MOD
	res = 0
	for i in range(1, n + 1):
		for j in range(i, n + 1):
			res += dp[m][i] * dp2[m][j] % MOD
			res = res % MOD
	return res
nm = list(map(int, stdin.readline().split()))
n = nm[0]
m = nm[1]
res = getsatisfyingnumbers(n, m)
stdout.write(str(res))


(n, m) = map(int, input().split())
a = []
m *= 2
if n == 1:
	print(1)
else:
	for i in range(n + m):
		a.append(0)
	now = 1
	for i in range(1, n + m):
		now = now * i
		a[i - 1] = now
	ans = a[n + m - 2] // (a[m - 1] * a[n - 2])
	print(ans % 1000000007)


from sys import stdin, stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
input = stdin.readline
prin = stdout.write
from random import sample
from collections import Counter, deque
from fractions import *
from math import sqrt, ceil, log2, gcd, cos, pi
mod = 10 ** 9 + 7

def ps(n):
	cp = 0
	lk = 0
	arr = {}
	while n % 2 == 0:
		n = n // 2
		lk += 1
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		lk = 0
		cc = 0
		while n % ps == 0:
			n = n // ps
			lk += 1
	if n != 1:
		lk += 1
		return False
	return True

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def factorials(n, r):
	slr = n
	dpr = r
	qlr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(n - r + 1, n + 1):
		qlr = qlr * ip % mod
	for ij in range(1, r + 1):
		qs = qs * ij % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def power(arr):
	listrep = arr
	subsets = []
	for i in range(2 ** len(listrep)):
		subset = []
		for k in range(len(listrep)):
			if i & 1 << k:
				subset.append(listrep[k])
		subsets.append(subset)
	return subsets

def pda(n):
	list = []
	su = 0
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				list.append(i)
				su += i
			else:
				list.append(n // i)
				list.append(i)
				su += i
				su += n // i
	return su

def dis(xa, ya, xb, yb):
	return sqrt((xa - xb) ** 2 + (ya - yb) ** 2)

def ii():
	return int(input())

def ilist():
	return [int(x) for x in input().strip().split()]

def islist():
	return list(map(str, input().split().rstrip()))

def inp():
	return input().strip()

def google(test, ans):
	return 'Case #' + str(test) + ': ' + str(ans)

def overlap(x1, y1, x2, y2):
	if x2 > y1:
		return y1 - x2
	if y1 > y2:
		return y2 - x2
	return y1 - x2

def dist(x1, y1, x2, y2):
	return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
t = 1
for p in range(t):
	(n, m) = ilist()
	print(factorials(n + 2 * m - 1, 2 * m))


import sys
input = sys.stdin.readline

def nCk(n, k):
	from math import factorial
	return factorial(n) // (factorial(k) * factorial(n - k))
(n, m) = map(int, input().split())
MOD = 10 ** 9 + 7
print(int(nCk(n + 2 * m - 1, 2 * m) % MOD))


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
mx = 1000000007
(n, m) = invr()
dp = [[0 for i in range(n + 1)] for j in range(2 * m + 1)]
for i in range(n + 1):
	dp[1][i] = 1
for i in range(1, 2 * m + 1):
	for j in range(1, n + 1):
		dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
print(sum(dp[2 * m]) % mx)


import math
(a, b) = map(int, input().split())
MOD = int(1000000000.0 + 7)
ans = f = a + 2 * b - 1
for i in range(2 * b - 1):
	f -= 1
	ans *= f
for i in range(2 * b):
	ans //= i + 1
print(ans % MOD)


import math
(n, m) = map(int, input().split())
r = 10 ** 9 + 7
a = math.factorial(n + 2 * m - 1)
b = math.factorial(2 * m) * math.factorial(n - 1)
a = a // b
print(a % r)


MOD = 10 ** 9 + 7
(n, m) = [int(x) for x in input().split()]
dp = [[0 for _ in range(2 * m + 1)] for __ in range(n + 1)]
dp[1][1] = 1
for r in range(1, n + 1):
	for c in range(1, 2 * m + 1):
		if r > 1:
			dp[r][c] += dp[r - 1][c]
		if c > 1:
			dp[r][c] += dp[r][c - 1]
		dp[r][c] %= MOD
dp2 = [0]
for i in range(1, n + 1):
	dp2.append(dp[i][2 * m - 1])
ans = 0
cumu = 0
counts = n
for endR in range(1, n + 1):
	ans += dp2[endR] * counts
	ans %= MOD
	counts -= 1
print(ans)


def power(x, y):
	if y == 0:
		return 1
	elif y % 2:
		return x * power(x, y - 1)
	else:
		return power(x, y / 2) * power(x, y / 2)
a = [1]
M = power(10, 9) + 7
for i in range(1, 1400):
	a.append(a[i - 1] * i)
(n, m) = map(int, input().split(' '))
print(a[2 * m + n - 1] // (a[2 * m] * a[n - 1]) % M)


from math import factorial
(n, m) = map(int, input().split())
ans = factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1))
print(ans % 1000000007)


(n, m) = list(map(int, input().split()))
matrix = [[0] * n for i in range(m)]
prefixSum = [[0] * n for i in range(m)]
z = 10 ** 9 + 7
for i in range(m):
	matrix[i][0] = 1
	prefixSum[i][0] = 1
for i in range(1, n):
	matrix[0][i] = (i + 1) * (i + 2) // 2 % z
	prefixSum[0][i] = (prefixSum[0][i - 1] + matrix[0][i]) % z
for i in range(1, m):
	for j in range(1, n):
		matrix[i][j] = (matrix[i][j - 1] + prefixSum[i - 1][j]) % z
		prefixSum[i][j] = (prefixSum[i][j - 1] + matrix[i][j]) % z
print(matrix[m - 1][n - 1])


(n, m) = [int(s) for s in input().split()]
s = 1
for i in range(n, n + 2 * m):
	s *= i
for i in range(1, 2 * m + 1):
	s //= i
print(s % 1000000007)


mod = 1000000007
(n, m) = map(int, input().split())
dp = [[0 for i in range(n + 1)] for j in range(m + 1)]
for i in range(1, m + 1):
	dp[i][1] = 1
for i in range(1, n + 1):
	dp[1][i] = 1
for i in range(2, m + 1):
	for j in range(2, n + 1):
		for k in range(1, j + 1):
			dp[i][j] += dp[i - 1][k]
			dp[i][j] = dp[i][j] % mod
cnt = 0
for i in range(1, n + 1):
	for j in range(1, i + 1):
		cnt = cnt + dp[m][n - i + 1] * dp[m][j] % mod
		cnt = cnt % mod
print(cnt)


import sys
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
MOD = 10 ** 9 + 7
MAX_N = 2000

def single_mod_nCr(n, r):
	if n < r or n < 0 or r < 0:
		return 0
	if r > n - r:
		r = n - r
	ret = 1
	for i in range(r):
		ret *= n - i
		ret *= pow(i + 1, MOD - 2, MOD)
		ret %= MOD
	return ret
(n, m) = [int(item) for item in input().split()]
print(single_mod_nCr(n + m * 2 - 1, m * 2))


(n, m) = list(map(int, input().split()))
M = 2 * m
ncr = n
mcr = 1
_sum = ncr
for i in range(2, min(n, M) + 1):
	ncr = ncr * (n - i + 1) // i
	mcr = mcr * (M - i + 1) // (i - 1)
	_sum += ncr * mcr
print(_sum % 1000000007)


MOD = 1000000007

def power(a, b, mod):
	res = 1
	while b:
		if b % 2:
			res = res * a % mod
		b //= 2
		a = a * a % mod
	return res % mod
(n, m) = map(int, input().split())
fac = [1, 1]
for i in range(2, 1500):
	fac.append(fac[-1] * i % MOD)
res = fac[2 * m + n - 1] % MOD
res = res * power(fac[2 * m], MOD - 2, MOD) % MOD
res = res * power(fac[n - 1], MOD - 2, MOD) % MOD
print(res)


M = 10 ** 9 + 7

def fact(n):
	x = 1
	for i in range(1, n + 1):
		x = x * i % M
	return x

def c(n, r):
	den = fact(n - r) * fact(r)
	return fact(n) * pow(den, M - 2, M) % M
(n, m) = map(int, input().split())
print(c(n + 2 * m - 1, 2 * m))


(n, m) = [int(x) for x in input().split(' ')]
top = 2 * m + n - 1
m *= 2
ans = 1
div = 1
while m:
	ans *= top
	div *= m
	top -= 1
	m -= 1
print(ans // div % (10 ** 9 + 7))


from math import factorial as fact
MOD = 10 ** 9 + 7

def Com(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = map(int, input().split())
print(Com(n + 2 * m - 1, 2 * m) % MOD)


mod = 10 ** 9 + 7

def fact(x):
	s = 1
	while x > 0:
		s *= x
		x -= 1
	return s
(x, y) = map(int, input().split())
print(fact(2 * y + x - 1) // (fact(2 * y) * fact(x - 1)) % mod)


from math import factorial
x = list(map(int, input().split()))
n = x[0]
r = x[1]
m = 10 ** 9 + 7

def combination(n, r):
	return factorial(n) // (factorial(n - r) * factorial(r))
print(combination(n + 2 * r - 1, 2 * r) % m)


(n, m) = [int(x) for x in input().split()]
mod = 10 ** 9 + 7
dp = [[0 for i in range(n)] for i in range(m)]
for i in range(n):
	dp[0][i] = n - i
for i in range(1, m):
	for j in range(n):
		for k in range(j, n):
			dp[i][j] = (dp[i][j] + dp[i - 1][k] * (k - j + 1)) % mod
print(sum(dp[-1]) % mod)


def mod_inverse(n, mod=10 ** 9 + 7):
	return pow(n, mod - 2, mod)

def combination(n, k, mod=10 ** 9 + 7):
	numer = denom = 1
	for i in range(k):
		numer = numer * (n - i) % mod
		denom = denom * (i + 1) % mod
	return numer * mod_inverse(denom, mod) % mod
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
ans = 0
for k in range(1, n + 1):
	ans += combination(m + k - 2, k - 1) * combination(m + n - k, n - k)
	ans %= mod
print(ans)


def chs(n, i, md):
	deno = 1
	for j in range(n, n - i, -1):
		deno *= j
		deno %= md
	nume = 1
	for j in range(1, i + 1):
		nume *= pow(j, md - 2, md)
		nume %= md
	return deno * nume % md
(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
print(chs(n + 2 * m - 1, m * 2, mod))


import sys
import math
from collections import defaultdict, Counter

def power(x, y, m1):
	if y == 0:
		return 1
	p = power(x, y // 2, m1) % m1
	p = p * p % m1
	if y % 2 == 0:
		return p
	else:
		return x * p % m1
m1 = pow(10, 9) + 7
(n, m) = map(int, input().split())
ans = math.factorial(n + 2 * m - 1) // (math.factorial(2 * m) * math.factorial(n - 1))
print(ans % m1)


from math import factorial as fact

def comb(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = [int(x) for x in input().split()]
M = 1000000007
print(comb(n + 2 * m - 1, 2 * m) % M)


def binomialCoef(n, k):
	C = [[0 for x in range(k + 1)] for x in range(n + 1)]
	for i in range(n + 1):
		for j in range(min(i, k) + 1):
			if j == 0 or j == i:
				C[i][j] = 1
			else:
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
	return C[n][k]
(n, m) = map(int, input().split())
M = 1000000007
print(int(int(binomialCoef(n + 2 * m - 1, 2 * m)) % M))


MOD = int(1000000000.0 + 7)
read = input().split()
n = int(read[0])
m = int(read[1])
f = [[0 for i in range(n + 1)] for j in range(m + 1)]
for i in range(1, n + 1):
	f[1][i] = 1
for i in range(2, m + 1):
	f[i][1] = 1
	for j in range(2, n + 1):
		f[i][j] = f[i][j - 1] + f[i - 1][j]
ans = 0
for i in range(1, n + 1):
	tmp = 0
	for j in range(1, n - i + 2):
		tmp += f[m][j]
		tmp %= MOD
	ans += f[m][i] * tmp
	ans %= MOD
print(ans % MOD)


def binomialCoef(n, k):
	C = [[0 for x in range(k + 1)] for x in range(n + 1)]
	for i in range(n + 1):
		for j in range(min(i, k) + 1):
			if j == 0 or j == i:
				C[i][j] = 1
			else:
				C[i][j] = C[i - 1][j - 1] + C[i - 1][j]
	return C[n][k]
(n, m) = list(map(int, input().strip().split()))
a = 10 ** 9 + 7
print(binomialCoef(n + 2 * m - 1, 2 * m) % a)


import math
mod = pow(10, 9) + 7
(n, m) = map(int, input().split())
print(math.factorial(n + 2 * m - 1) // (math.factorial(2 * m) * math.factorial(n - 1)) % mod)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
(n, m) = inputnums()
mod = 1000000007
ans = nCr(n + 2 * m - 1, 2 * m) % mod
print(ans)


import math

def helper(dp, h, w):
	if h < 0 or w < 0:
		return 1
	if h == 0 or w == 0:
		dp[h][w] = h + 1
		return dp[h][w]
	if dp[h][w] != -1:
		return dp[h][w]
	dp[h][w] = 0
	for i in range(h + 1):
		dp[h][w] += helper(dp, i, w - 1)
	return dp[h][w]

def solve():
	(n, m) = map(int, input().split())
	modulo = 10 ** 9 + 7
	dp = [[-1] * (m + 1) for _ in range(n + 1)]
	ans = 0
	for h in range(n):
		ans += helper(dp, h, m - 2) * helper(dp, n - h - 1, m - 1)
	print(ans % modulo)
for _ in range(1):
	solve()


(n, m) = input().split()
(n, m) = (int(n), int(m))

def twoarrays(n, m):
	m = 2 * m
	mod = 10 ** 9 + 7
	dp = {}
	for i in range(m):
		dp[i] = {}
		for j in range(n):
			if j == 0:
				dp[i][j] = 1
			elif i == 0:
				dp[i][j] = j + 1
			else:
				dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % mod
	return dp[m - 1][n - 1]
print(twoarrays(n, m))


modu = 1000000007
(N, M) = map(int, input().split())
ans = [[-1] * M for i in range(N)]

def getAns(n, m):
	if ans[n - 1][m - 1] != -1:
		return ans[n - 1][m - 1]
	elif m == 1:
		ans[n - 1][0] = n * (n + 1) // 2 % modu
	else:
		k = 0
		for i in range(n):
			k = (k + getAns(n - i, m - 1) * (i + 1) % modu) % modu
		ans[n - 1][m - 1] = k
	return ans[n - 1][m - 1]
print(getAns(N, M))


(n, m) = [int(x) for x in input().split()]
dp = [[0] * n for x in range(m)]
mod = 1000000007
for i in range(n):
	dp[0][i] = 1
for j in range(m):
	dp[j][0] = 1
for i in range(1, m):
	for j in range(1, n):
		dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod
cumsum = []
cs = 0
for j in range(n):
	cs += dp[m - 1][j] % mod
	cumsum.append(cs)
ans = 0
i = n - 1
for j in range(n):
	ans = (ans + dp[m - 1][j] * cumsum[i]) % mod
	i -= 1
print(ans)


from math import factorial
mod = 1000000007
(n, m) = [int(i) for i in input().split()]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))
print(ncr(n + 2 * m - 1, 2 * m) % mod)


import math
(n, m) = map(int, input().split())
MOD = int(1000000000.0 + 7)

def C(n, m):
	return math.factorial(n) // (math.factorial(m) * math.factorial(n - m))
print(C(n + 2 * m - 1, 2 * m) % MOD)


import sys

def fact(n):
	res = 1
	for i in range(1, n + 1):
		res *= i
	return res
(n, m) = map(int, input().split())
x = fact(n + 2 * m - 1)
y = fact(2 * m)
z = fact(n - 1)
print(x // (y * z) % 1000000007)


import math

def nCr(n, k, p):
	num = den = 1
	for i in range(k):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
(n, m) = map(int, input().split(' '))
N = 10 ** 9 + 7
endsWith = [0] * (n + 1)
startsWith = [0] * (n + 1)
prod = [0] * (n + 1)
for k in range(1, n + 1):
	endsWith[k] = nCr(k + m - 2, m - 1, N)
	startsWith[k] = nCr(m + n - k, m, N)
tot = 0
for i in range(1, n + 1):
	tot += endsWith[i] * startsWith[i] % N
tot %= N
print(tot)


MODULO = 10 ** 9 + 7
MAX_N = 1000 + 100
facts = [1 for _ in range(MAX_N)]
for i in range(1, MAX_N):
	facts[i] = i * facts[i - 1] % MODULO
(n, m) = map(int, input().split())
m_1_fact_1 = pow(facts[m - 1], MODULO - 2, MODULO)

def get_combinations(variants, m):
	line = variants + m - 2
	i = m - 1
	ans = 1
	for j in range(i):
		ans *= line - j
		ans %= MODULO
	return ans * m_1_fact_1 % MODULO
ans = 0
for a_border in range(1, n + 1):
	for b_border in range(a_border, n + 1):
		ans += get_combinations(a_border, m) * get_combinations(n - b_border + 1, m)
		ans = ans % MODULO
print(ans)


from math import factorial as f
(n, m) = [int(__) for __ in input().strip().split()]
mod = 10 ** 9 + 7
x = f(n + 2 * m - 1) // (f(n - 1) * f(2 * m))
print(int(x) % mod)


from math import factorial as fact
e = int(1000000000.0 + 7)

def ncr(a, b):
	return fact(a) // (fact(b) * fact(a - b))
(n, m) = map(int, input().split())
print(ncr(n + 2 * m - 1, n - 1) % e)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
res = 0
fact = [1]
fact_inv = [1]
for i in range(10 ** 4 + 5):
	new_fact = fact[-1] * (i + 1) % mod
	fact.append(new_fact)
	fact_inv.append(pow(new_fact, mod - 2, mod))

def mod_comb_k(n, k, mod):
	return fact[n] * fact_inv[k] % mod * fact_inv[n - k] % mod
for k in range(1, n + 1):
	a = mod_comb_k(m + k - 2, k - 1, mod)
	b = mod_comb_k(n + m - k, m, mod)
	res = (res + a * b) % mod
print(res)


(n, m) = [int(i) for i in input().split()]
if m == 1:
	print(n * (n - 1) // 2 + n)
else:
	l = [[0], [1, 1]]
	for i in range(2, n + 2 * m):
		l1 = [1]
		for j in range(1, i):
			p = (l[-1][j] + l[-1][j - 1]) % 1000000007
			l1.append(p)
		l1.append(1)
		l.append(l1[:])
	ans = l[n + 2 * m - 1][n - 1]
	print(ans)


import math

def ncr(n, r):
	n = int(n)
	r = int(r)
	return math.factorial(n) // math.factorial(r) // math.factorial(n - r)
M = 1000000007
(n, m) = input().split()
n = int(n)
m = int(m)
ans = ncr(m + m + n - 1, n - 1)
ans %= M
print(ans)


from collections import deque, Counter
import array
from itertools import combinations, permutations
from math import sqrt, factorial

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
(n, m) = read_int_array()
print(int(factorial(n + 2 * m - 1) // (factorial(2 * m) * factorial(n - 1)) % (10 ** 9 + 7)))


def ncr(n, r):
	arr = [[0 for x in range(r + 1)] for x in range(n + 1)]
	for i in range(n + 1):
		for j in range(min(i, r) + 1):
			if j == 0 or j == i:
				arr[i][j] = 1
			else:
				arr[i][j] = arr[i - 1][j] + arr[i - 1][j - 1]
	return arr[n][r]
[n, m] = list(map(int, input().strip().split()))
print(ncr(n + 2 * m - 1, n - 1) % (10 ** 9 + 7))


MOD = 7 + 10 ** 9
(n, m) = map(int, input().split())
ans = 1
for i in range(2 * m + 1, 2 * m + n):
	ans *= i
for i in range(1, n):
	ans //= i
print(ans % MOD)


(n, m) = map(int, input().split())
m *= 2
odp = 1
p = 10 ** 9 + 7
c = 1001
dp = [[0 for i in range(c)] for j in range(21)]
for i in range(21):
	dp[i][1] = 1
for j in range(c):
	dp[1][j] = j
for i in range(2, 21):
	for j in range(2, c):
		dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % p
print(dp[m][n])


def ncr(n, r, m):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % m
		den = den * (i + 1) % m
	return num * pow(den, m - 2, m) % m
(n, m) = map(int, input().split())
k = 1000000007
ans = ncr(2 * m + n - 1, n - 1, k)
print(ans)


def main():
	(n, m) = map(int, input().split())
	(n, m, o, acc) = (n + 2 * m - 1, 2 * m, n - 1, [1] * 32)
	for p in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019):
		(a, b, c, pw) = (n // p, m, o, 0)
		while a:
			b //= p
			c //= p
			pw += a - b - c
			a //= p
		if pw:
			acc[pw] *= p
	res = acc.pop(1)
	for (pw, pq) in enumerate(acc, 1):
		if pq != 1:
			res = res * pow(pq, pw, 1000000007) % 1000000007
	print(res)
main()


MOD = 1000000007
C = [[0] * 20 for _ in range(1100)]
for i in range(1100):
	C[i][0] = 1
for i in range(1, 1100):
	C[i][0] = 1
	for j in range(1, 20):
		C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD
(N, M) = map(int, input().split())
ans = 0
for endA in range(1, N + 1):
	for endB in range(endA, N + 1):
		cases = C[M - 1 + endA - 1][M - 1] * C[M - 1 + N + 1 - endB - 1][M - 1]
		ans += cases % MOD
print(ans % MOD)


from math import factorial

def C(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
(N, M) = [int(i) for i in input().split()]
modulo = 10 ** 9 + 7
print(C(N + 2 * M - 1, 2 * M) % modulo)


(n, m) = map(int, input().split())
b = [1 for i in range(n)]
a = [1 for i in range(n)]
s = n
for i in range(m - 1):
	nes = 0
	news = 0
	for j in range(n):
		nes = nes + b[j]
		b[j] = b[j] + s - nes
		news = news + b[j]
		a[n - j - 1] = b[j]
	s = news
s = 0
for i in range(n):
	s1 = 0
	for j in range(i + 1):
		s1 = s1 + a[j]
	s = s + s1 * b[i]
print(s % (10 ** 9 + 7))


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random

def S_():
	return input()

def LS():
	return [i for i in input().split()]

def I():
	return int(input())

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10 ** 5)
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)

class Comb:

	def __init__(self, n, mo=10 ** 9 + 7):
		self.fac = [0] * (n + 1)
		self.inv = [1] * (n + 1)
		self.fac[0] = 1
		self.fact(n)
		for i in range(1, n + 1):
			self.fac[i] = i * self.fac[i - 1] % mo
			self.inv[n] *= i
			self.inv[n] %= mo
		self.inv[n] = pow(self.inv[n], mo - 2, mo)
		for i in range(1, n):
			self.inv[n - i] = self.inv[n - i + 1] * (n - i + 1) % mo
		return

	def fact(self, n):
		return self.fac[n]

	def invf(self, n):
		return self.inv[n]

	def comb(self, x, y):
		if y < 0 or y > x:
			return 0
		return self.fac[x] * self.inv[x - y] * self.inv[y] % mo
show_flg = False
show_flg = True
ans = 0
cm = Comb(2000)
(n, m) = LI()
ans = 0
for s in range(1, n + 1):
	for t in range(s, n + 1):
		tmp = cm.comb(t - s + 2 * (m - 1), 2 * (m - 1))
		ans += tmp
		ans %= mo
print(ans)


z = 1000000007

def nCr(n, r):
	ncr = 1
	for i in range(0, r):
		ncr = int(n - i) * ncr // (i + 1)
	return ncr
(n, m) = map(int, input().split())
print(int(nCr(n + 2 * m - 1, 2 * m) % z))


def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
mod = 1000000007
(n, m) = map(int, input().split())
print(ncr(n + 2 * m - 1, 2 * m, mod))


def binomial(n, k, mod):
	if n < k:
		(n, k) = (k, n)
	(res, d) = (1, 1)
	for i in range(k):
		res = res * (n - i) % mod
		d = d * (i + 1) % mod
	return res * pow(d, mod - 2, mod) % mod
MOD = 10 ** 9 + 7
(a, b) = map(int, input().split())
(p, q) = (a + 2 * b - 1, 2 * b)
print(binomial(p, q, MOD))


from math import factorial as fact
(n, m) = map(int, input().split())
mod = 10 ** 9 + 7

def comb(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def duplicateComb(n, r):
	return comb(n + r - 1, r)
print(duplicateComb(n, 2 * m) % mod)


from math import factorial
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

def MI():
	return map(int, input().split())

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)

def MS():
	return map(str, input().split())
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = True

def C(n, k):
	return math.factorial(n) // (math.factorial(k) * math.factorial(n - k))

def main():
	(n, m) = MI()
	print(C(2 * m + n - 1, 2 * m) % MOD)
main()


from math import comb
d = 1000000007
(n, m) = map(int, input().split())
sol = 0
for i in range(n):
	sol += comb(i + m, m) * comb(n - i + m - 2, m - 1) % d
print(sol % d)


def factorial(n):
	fact = 1
	for i in range(1, n + 1):
		fact = fact * i
	return fact

def Combinacion(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
a = input()
a = a.split(' ')
(n, m) = (int(a[0]), int(a[1]))
modulo = 10 ** 9 + 7
resultado = Combinacion(n + 2 * m - 1, 2 * m) % modulo
print(resultado)


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	(n, m) = RL()
	dp = [[0] * (n + 1) for _ in range(2 * m + 1)]
	for i in range(1, n + 1):
		dp[1][i] = 1
	for i in range(2, 2 * m + 1):
		for j in range(1, n + 1):
			sm = 0
			for k in range(1, j + 1):
				sm += dp[i - 1][k] % mod
			dp[i][j] = sm
	print(sum(dp[-1]) % mod)
main()


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(N, M) = getInts()
	dp = [[0 for j in range(N)] for i in range(2 * M)]
	for j in range(N):
		dp[0][j] = 1
	for i in range(1, 2 * M):
		for j in range(N):
			dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD
	return sum(dp[2 * M - 1]) % MOD
print(solve())


def calc(n, m):
	r = 1
	for i in range(n, n + 2 * m):
		r *= i
	for i in range(1, 2 * m + 1):
		r //= i
	return r % (10 ** 9 + 7)
T = 1
for _ in range(T):
	(a, b) = [int(x) for x in input().split()]
	print(calc(a, b))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = 1
for _ in range(t):
	(n, m) = inp()
	dp = [[0] * m for i in range(n)]
	for i in range(n):
		dp[i][0] = 1
	for j in range(1, m):
		for i in range(n):
			ch = 0
			for k in range(i, -1, -1):
				ch += dp[k][j - 1]
				ch %= mod
			dp[i][j] += ch
			dp[i][j] %= mod
	inc_dp = list(dp)
	dp = [[0] * m for i in range(n)]
	for i in range(n):
		dp[i][0] = 1
	for j in range(1, m):
		for i in range(n):
			ch = 0
			for k in range(i, n):
				ch += dp[k][j - 1]
				ch %= mod
			dp[i][j] += ch
			dp[i][j] %= mod
	dec_dp = list(dp)
	ans = 0
	for i in range(n):
		for j in range(i, -1, -1):
			ans += inc_dp[j][m - 1] * dec_dp[i][m - 1] % mod
			ans %= mod
	out(ans)


(n, m) = map(int, input().split())
from math import factorial

def comb(f, r):
	t = factorial(f) // (factorial(r) * factorial(f - r))
	return t
ans = comb(2 * m + n - 1, 2 * m)
print(ans % (10 ** 9 + 7))


f = [1]
MOD = 1000000007

def fact():
	for i in range(1, 1021):
		f.append(f[i - 1] * i)

def main():
	(n, m) = map(int, input().split())
	x = f[2 * m + n - 1]
	y = f[2 * m]
	z = f[n - 1]
	print(x // (y * z) % MOD)
fact()
main()


import math
_MOD = 10 ** 9 + 7

def solve(n: int, m: int) -> int:
	return math.factorial(n + 2 * m - 1) // math.factorial(2 * m) // math.factorial(n - 1) % _MOD
assert solve(2, 2) == 5
assert solve(10, 1) == 55
assert solve(723, 9) == 157557417
(n, m) = map(int, input().split())
r = solve(n, m)
print(r)


import math
mod = pow(10, 9) + 7

def factori(n):
	ans = 1
	for i in range(1, n + 1):
		ans = ans * i % mod
	return ans

def tavan(n, m):
	ans = 1
	for i in range(m):
		ans = ans * n % mod
	return ans
(n, m) = [int(i) for i in input().split()]
print(math.factorial(2 * m + n - 1) // math.factorial(2 * m) // math.factorial(n - 1) % mod)


import math
mac = 10 ** 9 + 7

def comb(a, b):
	return math.factorial(a) // (math.factorial(b) * math.factorial(a - b))
(n, m) = map(int, input().split())
print(comb(2 * m + n - 1, 2 * m) % mac)


(n, m) = input().split()
n = int(n)
m = int(m)
c = 2 * m
ans1 = 1
ans2 = 1
ans3 = 1
for i in range(1, n + c):
	ans1 *= i
for i in range(1, c + 1):
	ans2 *= i
for i in range(1, n):
	ans3 *= i
kk = ans2 * ans3
op = ans1 // kk
print(op % 1000000007)


from math import factorial as f
MOD = 10 ** 9 + 7

def C(n, k):
	res = f(n) // (f(n - k) * f(k))
	return res
(n, m) = map(int, input().split())
res = C(n + 2 * m - 1, 2 * m) % MOD
print(res)


(n, m) = map(int, input().split())
dp1 = [[0 for _ in range(n)] for i in range(m)]
dp2 = [[0 for _ in range(n)] for i in range(m)]
for j in range(n):
	dp1[0][j] = 1
	dp2[0][j] = 1
for i in range(1, m):
	for j in range(n):
		for z in range(j, n):
			dp1[i][j] += dp1[i - 1][z]
			dp1[i][j] %= 1000000007
		for z in range(j + 1):
			dp2[i][j] += dp2[i - 1][z]
			dp2[i][j] %= 1000000007
ans = 0
for i in range(n):
	for j in range(i + 1):
		ans += dp2[-1][j] * dp1[-1][i] % 1000000007
		ans %= 1000000007
print(ans)


from math import factorial as fact
M = 10 ** 9 + 7
(x, m) = map(int, input().split())
(n, k) = (x, 2 * m)
print(fact(n + k - 1) // (fact(k) * fact(n - 1)) % M)


import math
f = math.factorial
mod = 10 ** 9 + 7
(n, m) = map(int, input().split())
num = math.factorial(n + 2 * m - 1)
den = math.factorial(2 * m) * math.factorial(n - 1)
fraction = num // den
print(int(fraction % mod))


from math import factorial

def put():
	return map(int, input().split())
(n, m) = put()
MOD = int(1000000000.0 + 7)
n = n + 2 * m - 1
r = 2 * m
ans = factorial(n) // (factorial(r) * factorial(n - r))
print(ans % MOD)


dp = [[0 for k in range(1002)] for j in range(22)]
try:
	while True:
		(n, m) = map(int, input().split())
		m = m * 2
		for i in range(1, n + 1):
			dp[1][i] = 1
		for j in range(1, m + 1):
			dp[j][n + 1] = 0
		for i in range(2, m + 1):
			for j in range(n, 0, -1):
				dp[i][j] = (dp[i - 1][j] + dp[i][j + 1]) % 1000000007
		ans = 0
		for i in range(1, n + 1):
			ans = (ans + dp[m][i]) % 1000000007
		print(ans)
except EOFError:
	pass


from math import factorial
(n, m) = map(int, input().split())
ans = 0

def C(n, m):
	return factorial(n) // (factorial(m) * factorial(n - m))
for i in range(2 * m, 0, -1):
	if i > n:
		continue
	if i != 1:
		ans = ans + C(n, i) * C(2 * m - i + i - 1, i - 1)
	else:
		ans = ans + n
print(ans % (10 ** 9 + 7))


import sys
import math
from collections import deque
import random

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
mod = int(1000000000.0) + 7
(n, m) = read_int_line()
ans = 0
ans = ncr(n + 2 * m - 1, 2 * m, mod)
print(ans)


(n, m) = input('').split()
n = int(n)
m = int(m)
import math
val = n + 2 * m - 1
mod = 1000000007
val1 = 2 * m
val2 = math.factorial(val)
val3 = math.factorial(val1)
val4 = math.factorial(n - 1)
val5 = val3 * val4
val6 = val2 // val5
print(val6 % mod)


import math
(a, b) = [int(ele) for ele in input().split()]
inamo = 10 ** 9 + 7
res = math.factorial(a + b * 2 - 1) // math.factorial(a - 1) // math.factorial(b * 2) % inamo
print(res)


from sys import stdin
(n, m) = (int(v) for v in stdin.readline().split())
MODULUS = 10 ** 9 + 7
mod = lambda x: x % MODULUS
nondesc_count = [1] * (m + 1)
nondesc_count_sum = [None] * (n + 1)
nondesc_count_sum[1] = m
for i in range(1, n):
	nondesc_count_next = [None] * (m + 1)
	nondesc_count_next[0] = 1
	for j in range(1, m + 1):
		nondesc_count_next[j] = mod(nondesc_count_next[j - 1] + nondesc_count[j])
	nondesc_count_sum[i + 1] = sum((nondesc_count_next[j] for j in range(m)))
	nondesc_count = nondesc_count_next
pair_count = [1] * (m + 1)
for i in range(1, n):
	pair_count_next = [None] * (m + 1)
	for j in range(0, m + 1):
		count = 0
		for k in range(j, m + 1):
			count = mod(count + pair_count[k])
		count = mod(count + nondesc_count_sum[i])
		pair_count_next[j] = count
	pair_count = pair_count_next
print(pair_count[0])


from math import factorial
m = 10 ** 9 + 7
(a, b) = map(int, input().split())
x = factorial(a - 1 + 2 * b)
y = factorial(2 * b)
z = factorial(a - 1)
print(x // (y * z) % m)


MOD = 10 ** 9 + 7
(n, m) = [int(x) for x in input().split()]
dp = [[0 for _ in range(m + 1)] for __ in range(n + 1)]
dp[1][1] = 1
for r in range(1, n + 1):
	for c in range(1, m + 1):
		if r > 1:
			dp[r][c] += dp[r - 1][c]
		if c > 1:
			dp[r][c] += dp[r][c - 1]
		dp[r][c] %= MOD
dp2 = [0]
for i in range(1, n + 1):
	dp2.append(dp[i][m])
p = [0]
for i in range(1, n + 1):
	temp = p[-1] + dp2[i]
	temp %= MOD
	p.append(temp)
ans = 0
for bLowerBound in range(1, n + 1):
	ans += dp2[n + 1 - bLowerBound] * p[bLowerBound] % MOD
	ans %= MOD
print(ans)


def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res
(n, m) = [int(x) for x in input().split()]
print(nCr(2 * m + n - 1, 2 * m) % 1000000007)


import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
(N, M) = map(int, readline().split())
dp = [0] + [1] * N
for _ in range(2 * M):
	dp2 = dp[:]
	for i in range(1, N + 1):
		dp2[i] = (dp2[i] + dp2[i - 1]) % MOD
	dp = dp2[:]
print(dp[N])


import math
(n, m) = [int(_) for _ in input().split()]
print(math.comb(n + 2 * m - 1, 2 * m) % 1000000007)


def modmal(a, b, mod):
	return a * b % mod

def moddiv(a, b, mod):
	return a * pow(b, mod - 2) % mod

def inverse(a, mod):
	return pow(a, mod - 2)

def modfac(n, MOD):
	f = 1
	factorials = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factorials.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	invs[n] = inv
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factorials, invs)

def modnCr(n, r, mod, fac, inv):
	return fac[n] * inv[n - r] * inv[r] % mod
for loop in range(1):
	(n, m) = map(int, input().split())
	mod = 10 ** 9 + 7
	ans = 0
	(fac, inv) = modfac(1010, mod)
	for i in range(n):
		i += 1
		for j in range(i):
			j += 1
			ans += modnCr(m + j - 2, j - 1, mod, fac, inv) * modnCr(m + n - i - 1, n - i, mod, fac, inv)
			ans %= mod
	print(ans)


import math
(n, m) = input().split()
n = int(n)
m = int(m)
mod = 10 ** 9 + 7
c = math.factorial(n + 2 * m - 1)
d = math.factorial(2 * m) * math.factorial(n - 1)
print(c // d % mod)


from math import factorial as fact

def C(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = map(int, input().split())
ans1 = C(n + 2 * m - 1, 2 * m)
ans = int(ans1 % (10 ** 9 + 7))
print(ans)


import math
mod = 1000000007
arr = [int(x) for x in input().split()]
n = arr[0]
m = arr[1]
print(math.factorial(2 * m + n - 1) // math.factorial(2 * m) // math.factorial(n - 1) % mod)


def solve():
	MOD = 10 ** 9 + 7
	nm = input().split()
	n = int(nm[0])
	m = int(nm[1])
	C = [[1 for _ in range(n + m)] for _ in range(m + 1)]
	for i in range(m + 1):
		for j in range(i, n + m):
			if i == j:
				C[i][j] = 1
			elif i == 0:
				C[i][j] = 1
			else:
				C[i][j] = (C[i][j - 1] + C[i - 1][j - 1]) % MOD
	result = 0
	for i in range(1, n + 1):
		numA = C[m][i + m - 1]
		numA = numA % MOD
		numB = C[m - 1][n - i + m - 1]
		numB = numB % MOD
		result += numA * numB % MOD
		result = result % MOD
	print(result)
solve()


from sys import stdin, stdout
from math import gcd, sqrt, factorial
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7

def C(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
(n, m) = R()
print(C(n + 2 * m - 1, 2 * m) % N)


import math
MOD = 10 ** 9 + 7
(n, m) = map(int, input().split())
fact = [1] * (n + m + 5 + 2)
fact[1] = 1
for i in range(2, len(fact)):
	fact[i] = i * fact[i - 1]

def komb(k, n):
	res = fact[n] // fact[k] // fact[n - k]
	if type(res) is not int:
		print(k, n)
		return
	return res

def kpowt(k, n):
	return komb(k, n + k - 1)
res = 0
for ost in range(n):
	gmin = 1 if ost else m
	for g in range(gmin, m + 1):
		dmin = m if ost == n - 1 else 0
		for d in range(dmin, m + 1):
			cze = kpowt(ost - 1, m - g + 1) if ost else 1
			cze *= kpowt(n - 1 - ost - 1, m - d + 1) if ost < n - 1 else 1
			cze = cze % MOD
			res += cze
print(res % MOD)


(n, m) = map(int, input().split())
mod = int(10 ** 9 + 7)
dp = [[0 for i in range(n + 1)] for i in range(2 * m + 1)]
for i in range(1, n + 1):
	dp[1][i] = 1
for i in range(2, 2 * m + 1):
	for j in range(1, n + 1):
		sumi = 0
		for k in range(1, j + 1):
			sumi += dp[i - 1][k]
			sumi %= mod
		dp[i][j] = sumi
print(sum(dp[2 * m]) % mod)


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))

def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))
from math import factorial as fact

def nCr(n, k):
	return fact(n) // (fact(k) * fact(n - k))
(n, m) = I()
sum1 = 0
sum2 = 0
print(nCr(n + 2 * m - 1, 2 * m) % (10 ** 9 + 7))


import itertools

def C(n, k):
	if 0 <= k <= n:
		nn = 1
		kk = 1
		for t in range(1, min(k, n - k) + 1):
			nn *= n
			kk *= t
			n -= 1
		return nn // kk
	else:
		return 0
ls = list(map(int, input().split()))
n = ls[0]
m = ls[1]
print(C(n + 2 * m - 1, 2 * m) % 1000000007)


(n, m) = map(int, input().split())
res = list(range(1, n + 1))
for i in range(1, m):
	for j in range(1, n):
		res[j] += res[j - 1]
	for j in range(1, n):
		res[j] += res[j - 1]
for j in range(1, n):
	res[j] += res[j - 1]
print(res[-1] % 1000000007)


mod = 1000000007
maxn = 1000 + 20
fac = [0] * maxn
fac[0] = fac[1] = 1
for i in range(2, len(fac)):
	fac[i] = fac[i - 1] * i % mod

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(gcd, x, y) = egcd(b % a, a)
		return (gcd % mod, (y - b // a * x) % mod, x % mod)

def inverse(x, mod):
	(g, x, y) = egcd(x, mod)
	if g != 1:
		assert False, 'No solution!'
	else:
		x = (x % mod + mod) % mod
		return x

def mod_inverse(n, mod=10 ** 9 + 7):
	return pow(n, mod - 2, mod)

def c(n, k, mod):
	return fac[n] % mod * (inverse(fac[k], mod) % mod) * inverse(fac[n - k], mod) % mod
(N, M) = list(map(int, input().strip().split(' ')))
print(c(N + 2 * M - 1, N - 1, mod))


(n, m) = input().split()
n = int(n)
m = int(m)
MOD = 1000000000.0 + 7
dp = [[0 for i in range(0, n + 1)] for i in range(0, 2 * m + 1)]
for i in range(1, n + 1):
	dp[1][i] = i
for i in range(2, 2 * m + 1):
	for j in range(1, n + 1):
		dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
		dp[i][j] %= MOD
print(int(dp[2 * m][n]))


nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
output = 0
dp = [1] * n
md = 10 ** 9 + 7
for i in range(1, m):
	buf1 = dp[0]
	for j in range(1, n):
		dp[0] += dp[j]
	for j in range(1, n):
		buf2 = dp[j]
		dp[j] = dp[j - 1] - buf1
		buf1 = buf2
for i in range(n):
	dp[i] = dp[i] % md
sums = [1]
for i in range(1, n):
	sums.append(dp[n - 1 - i] + sums[i - 1])
	sums[i] = sums[i]
for i in range(n):
	output += dp[i] * sums[i]
	output = output % md
print(output)


(n, m) = [int(i) for i in input().split()]
mod = 1000000007
memo = [[0 for i in range(n + 1)] for i in range(2 * m + 1)]

def ways(i, l):
	if l == 0:
		return 1
	if i == n:
		return 1
	if memo[l][i] != 0:
		return memo[l][i]
	ans = 0
	for j in range(l + 1):
		ans += ways(i + 1, l - j) % mod
	ans %= mod
	memo[l][i] = ans
	return ans
print(ways(1, 2 * m))


from math import factorial as f
mod = 10 ** 9 + 7

def nCk(n, k):
	return f(n) // (f(k) * f(n - k))
(n, m) = map(int, input().split())
print(nCk(n + 2 * m - 1, 2 * m) % mod)


(N, M) = (int(i) for i in input().split())
arrays = [[1] * N for _ in range(M * 2)]
for n in range(1, N):
	arrays[0][n] = n + 1
for m in range(1, M * 2):
	for n in range(1, N):
		arrays[m][n] = sum(arrays[m - 1][:n + 1]) % 1000000007
print(arrays[M * 2 - 1][N - 1])


mod = 10 ** 9 + 7

def combination(n, r):
	if r > n - r:
		r = n - r
	res = 1
	for i in range(1, r + 1):
		res *= n - i + 1
		res //= i
	return res
(n, m) = map(int, input().split())
print(combination(n + 2 * m - 1, 2 * m) % mod)


MOD = 10 ** 9 + 7
(n, sz) = map(int, input().split())
waysA = [[0 for _ in range(n + 1)] for _ in range(sz + 1)]
waysB = [[0 for _ in range(n + 1)] for _ in range(sz + 1)]
for size in range(1, sz + 1):
	for cur in range(1, n + 1):
		if size == 1:
			waysA[size][cur] = 1
			waysB[size][cur] = 1
			continue
		for prev in range(1, cur + 1):
			waysA[size][cur] += waysA[size - 1][prev]
			waysA[size][cur] %= MOD
		for prev in range(cur, n + 1):
			waysB[size][cur] += waysB[size - 1][prev]
			waysB[size][cur] %= MOD
ret = 0
for a in range(1, n + 1):
	for b in range(a, n + 1):
		ret += waysA[sz][a] * waysB[sz][b]
		ret %= MOD
print(ret)


from math import factorial
(n, m) = map(int, input().split())
c = factorial(2 * m + n - 1)
z = factorial(2 * m) * factorial(n - 1)
print(c // z % (10 ** 9 + 7))


n_ = 2 * 10 ** 3
mod = 10 ** 9 + 7
fac = [1] * (n_ + 1)
for i in range(1, n_ + 1):
	fac[i] = fac[i - 1] * i % mod
inv = [1] * (n_ + 1)
inv[n_] = pow(fac[n_], mod - 2, mod)
for i in range(n_ - 1, 0, -1):
	inv[i] = inv[i + 1] * (i + 1) % mod

def nCr(n, r):
	if n <= 0 or r < 0 or r > n:
		return 0
	return fac[n] * inv[r] % mod * inv[n - r] % mod
(n, m) = map(int, input().split())
ans = nCr(n + 2 * m - 1, n - 1)
print(ans)


from math import factorial as fact
mod = 10 ** 9 + 7
(n, m) = list(map(int, input().split(' ')))

def C(n, m):
	return fact(n) // (fact(m) * fact(n - m))

def H(n, m):
	return C(n + m - 1, m)
print(H(n, 2 * m) % mod)


import sys
from math import comb
input = sys.stdin.readline
(n, m) = map(int, input().split())
print(comb(n + 2 * m - 1, 2 * m) % 1000000007)


import math
(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
f1 = math.factorial(n + 2 * m - 1)
f2 = math.factorial(2 * m)
f3 = math.factorial(n - 1)
ans = f1 // (f2 * f3) % mod
print(ans)


(n, m) = map(int, input().split())
mod = 10 ** 9 + 7
mod = 10 ** 9 + 7
rng = 100100
fctr = [1]
finv = [1]
for i in range(1, rng):
	fctr.append(fctr[-1] * i % mod)
for i in range(1, rng):
	finv.append(pow(fctr[i], mod - 2, mod))

def cmb(n, k):
	if n < 0 or k < 0:
		return 0
	else:
		return fctr[n] * finv[n - k] * finv[k] % mod
print(cmb(n + 2 * m - 1, n - 1))


from math import factorial as fct
MOD = 10 ** 9 + 7

def com(n, k):
	return fct(n) // (fct(k) * fct(n - k))
(n, m) = map(int, input().split())
print(com(n + 2 * m - 1, 2 * m) % MOD)


fact = []
fact.append(1)
for i in range(1, 2001):
	pro = fact[i - 1] * i % 1000000007
	fact.append(pro)
(n, m) = [int(x) for x in input().split()]
total = 0
for i in range(1, n + 1):
	count = fact[i - 1 + m - 1] * pow(fact[m - 1], 1000000005, 1000000007) * pow(fact[i - 1], 1000000005, 1000000007)
	count = count % 1000000007
	count = count * fact[n - i + m] * pow(fact[m], 1000000005, 1000000007) * pow(fact[n - i], 1000000005, 1000000007)
	count = count % 1000000007
	total = (total + count) % 1000000007
print(total)


import math
(n, m) = map(int, input().split())
v = n + 2 * m - 1
r = 2 * m
g = n - 1
print(math.factorial(v) // math.factorial(r) // math.factorial(g) % 1000000007)


def main():
	mod = 10 ** 9 + 7
	(n, m) = map(int, input().split())
	dp = [[0 for j in range(n)] for i in range(2 * m)]
	for j in range(n):
		dp[0][j] = 1
		if j > 0:
			dp[0][j] += dp[0][j - 1]
	for i in range(1, 2 * m):
		for j in range(n):
			dp[i][j] += dp[i - 1][j]
			dp[i][j] %= mod
		for j in range(1, n):
			dp[i][j] += dp[i][j - 1]
			dp[i][j] %= mod
	print(dp[-1][-1])
main()


from math import factorial as fact123
for _ in range(1):
	(n, m) = map(int, input().split())
	a = n + 2 * m - 1
	b = 2 * m
	ans = fact123(a) // (fact123(b) * fact123(abs(a - b)))
	print(ans % 1000000007)