import java.util.*; public class Main { static final int MOD = 1000000000; public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong() / 1000; int m = sc.nextInt(); int[][] comb = new int[m + 1][m + 1]; for (int i = 0; i <= m; i++) { for (int j = 0; j <= i; j++) { if (j == 0 || j == i) { comb[i][j] = 1; } else { comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD; } } } System.out.println(comb[m][(int)(n % m)]); } }