N, M = gets.split(" ").map{|s| s.to_i} MOD = 1000000007 nCr = 1 sum = nCr inv = [0, 1] j = 1 (N+1).upto(M) {|i| nCr = ((nCr * i % MOD) * inv[j]) % MOD sum = (sum + nCr) % MOD j += 1 inv[j] = MOD - inv[MOD % j] * (MOD / j) % MOD } puts sum