#include #include #include #include using namespace std; const int mod = 1000000000; int main() { long long n; int m; cin >> n >> m; n /= 1000; int atari = n - (n / m) * m; vector< vector > pascal; pascal.assign(m + 1, vector(m + 1, 0)); for (int i = 0; i <= m; i++) { pascal[i][0] = 1; } for (int i = 1; i <= m; i++) { for (int j = 1; j <= i; j++) { pascal[i][j] = (pascal[i][j - 1] + pascal[i][j]) % mod; } } cout << pascal[m][atari] << endl; return 0; }