defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts(if b, do: "Yes", else: "No") def divisors(n) do _divisors(1, n) |> MapSet.new |> Enum.sort end defp _divisors(x, n) do cond do x * x > n -> [] rem(n, x) == 0 -> [x, div(n, x) | _divisors(x+1, n)] true -> _divisors(x+1, n) end end def main do [a, b] = li() for d <- divisors(a), reduce: 0 do s -> s + case rem(d, b) do 0 -> 1 _ -> 0 end end |> IO.puts end end