#include <cstdio>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
typedef long long ll;
//------------------------------------------------------------------------------
ll mod_pow(ll x, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) {
res = res * x % mod;
}
x = x * x % mod;
n >>= 1;
}
return res;
}
ll mod_inverse(ll x, ll mod) {
return mod_pow(x, mod - 2, mod);
}
ll mod_comb2(ll n, ll k, ll mod) {
if (n < 0 || k < 0 || n < k) return 0;
if (k > n - k) k = n - k;
if (k == 0) return 1;
ll a = 1, b = 1;
while(k > 0) {
a = a * n-- % mod;
b = b * k-- % mod;
}
return a * mod_inverse(b, mod) % mod;
}
//------------------------------------------------------------------------------
const int MOD = 1e9+7;
int N, K;
void solve() {
int ans = 0;
if (N > K) {
ans = mod_comb2(N + K -1, K, MOD);
} else {
ans = mod_comb2(N, K % N, MOD);
}
printf("%d\n", ans);
}
void input() {
scanf("%d%d", &N, &K);
}
int main() {
input();
solve();
return 0;
}
./Main.cpp: In function ‘void input()’:
./Main.cpp:55:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &N, &K);
^