#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000000; ll ncr[10010][10010]; void nCr(int n){ REP(i,n+1)REP(j,i+1){ if(j==0)ncr[i][j]=1; else ncr[i][j]=(ncr[i-1][j]+ncr[i-1][j-1])%mod; } } int main(){ ll n; ll m; cin>>n; cin>>m; ll rest=0; rest=(n%(1000*m)); rest-=rest%1000; rest/=1000; nCr(m); print(ncr[m][rest]); }