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