#include #define MOD 1000000000 #define MAX 10001 typedef long long ll; using namespace std; ll N, M; ll dp[MAX][MAX] = {{0}}; ll nCr(ll n, ll r) { if(n==r) return dp[n][r] = 1; if(r==0) return dp[n][r] = 1; if(r==1) return dp[n][r] = n; if(dp[n][r]) return dp[n][r] % MOD; return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1); } int main(void){ cin >> N >> M; cout << nCr(M, (N / 1000) % M) % MOD << endl; return 0; }