import java.util.Arrays; import java.util.Scanner; // 変なMODとり public class Yuki129 { int MOD=1000000000; public long combination(int N, int K) { long ans = 1; for (int i = 1; i <= K; i++) { ans *= (N - i + 1) % MOD; ans /= i; } return ans; } public Yuki129() { Scanner scanner = new Scanner(System.in); long N = scanner.nextLong(); int M = scanner.nextInt(); long A = (N / 1000) / M; int K = (int)(N / 1000 - A * M); long ans = combination(M, K); System.out.println(ans); } public static void main(String[] args) { Yuki129 hoge = new Yuki129(); } }