#include #include #include #include #include #include #include #include #include #define int long long int #define rep(i, n) for(int i = 0; i < (n); ++i) using namespace std; typedef pair P; const int INF = 1e15; const int MOD = 1e9+7; signed main(){ int n, m; cin >> n >> m; n /= 1000; n %= m; vector> dp(m+1, vector(m+1)); dp[1][0] = 1; dp[1][1] = 1; for(int i = 1; i < m; i++){ for(int j = 0; j <= i; j++){ dp[i+1][j] += dp[i][j]; dp[i+1][j+1] += dp[i][j]; } } cout << dp[m][n] % 1000000000 << endl; return 0; }