import java.util.*; import java.math.BigInteger; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long M = sc.nextLong(); N /= 1000; long r = N % M; BigInteger p1 = new BigInteger("1"); for(int i = 2; i <= M; i++) { BigInteger p = new BigInteger(String.valueOf(i)); p1 = p1.multiply(p); } for(int i = 2; i <= r; i++) { BigInteger p = new BigInteger(String.valueOf(i)); p1 = p1.divide(p); } for(int i = 2; i <= M - r; i++) { BigInteger p = new BigInteger(String.valueOf(i)); p1 = p1.divide(p); } p1 = p1.mod(new BigInteger("1000000000")); System.out.println(p1); } }