class Integer
  def combination(k)
    self.factorial/(k.factorial*(self-k).factorial)
  end

  def permutation(k)
    self.factorial/(self-k).factorial
  end

  def factorial
    return 1 if self == 0
    (1..self).inject(:*)
  end
end

class Yukicoder
  MOD = 1000000000

  def initialize
    n = gets.to_i
    m = gets.to_i

    puts m.combination((n-m*1000*(n/m/1000))/1000) % MOD
  end
end

Yukicoder.new