def f(k,r)
	if k==0 && r==0
		return 1
	elsif k==0
		return 0
	elsif k<=r
		return 1
	else
		return 0
	end
end
memo=[]

m=2003
mod=10**9+7
ds=gets.split(" ").map{|e| e.to_i}
b1=ds[1]
r1=ds[0]-ds[1]

(m+2).times{|i|
	memo<<[]
	(m+2).times{
		memo[i]<<0
	}
}


(0..m).each{|i|
	s1=0
	(i..m).each{|j|
		if i==0
			memo[i][j]=1
		elsif i==1
			memo[i][j]=1
		else
			memo[i][j]=(memo[i-1][j-1]+s1)%mod
			s1=(s1+memo[i-1][j-1])%mod
		end
	}
}

b1.times{|i|
	k=i+1
	ans=(f(k,r1)*f(k,b1)*memo[k][r1]*memo[k][b1]*2)%mod
	ans=(ans+f(k+1,r1)*f(k,b1)*memo[k+1][r1]*memo[k][b1])%mod
	ans=(ans+f(k-1,r1)*f(k,b1)*memo[k-1][r1]*memo[k][b1])%mod
	
	p ans%mod
}