import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; //static boolean MAP[][]; static long N; static long M; static int MAX = -1; //static int tic[][]; static int MAP[][]; //static int max; static int DP[][][]; static int ST[][]; //static int p[]; //static ArrayList> al; static TreeMap> hm; //static ArrayList al; //static int a[][]; //static char[][] ch; //static ArrayList> al; //static String a[]; //static String str; public static void main(String[] args) { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); N = sc.nextLong()/1000; M =sc.nextInt(); BigInteger bi = new BigInteger("0"); long ans = 0; long let = N%M; //for (int i=1; i <= let; i++) { bi = bi.add(calcCombination(M, let)); //} if (bi.equals(new BigInteger("0"))) { bi = new BigInteger("1"); } System.out.println(bi.mod(new BigInteger(CY+""))); } /** * aCbを計算して返す */ static BigInteger calcCombination(long a, long b) { BigInteger rtn = new BigInteger("1"); long k = Math.min(b, a-b); if (k < 0) { return new BigInteger("0"); } for (long i=1; i <= k;i++) { rtn = rtn.multiply(new BigInteger((a-(i-1))+"")); rtn = rtn.divide(new BigInteger(i + "")); } return rtn; } }