//#include #include #include #include #include #include #include #define INF INT_MAX / 2 #define MOD 1000000007 using namespace std; typedef pair PII; typedef pair> PIPII; typedef long long ll; int dx[] = {0,1,0,-1}; int dy[] = {1,0,-1,0}; ll combi(ll n,ll r){ ll ret = 1; for(int i=n;i>n-r;i--){ ret *= i; ret %= MOD; } for(int i=r;i>=1;i--){ ret /= i; } return ret; } int main(void) { ll n,m; cin >> n >> m; ll nn = n/1000; ll amari = n - nn/m *1000*m; amari /= 1000; //cout << m << " " << amari << endl; cout << combi(m,amari) << endl; return 0; }