program abc110d
  implicit none
  integer(8), parameter :: modulo = 10**9 + 7
  integer(8) :: ans = 1
  integer(8) n, m, i, count

  read *, n, m
  i = 2
  do
     if (m < i * i) exit
     if (mod(m, i) == 0) then
        count = 0
        do
           m = m / i;
           count = count + 1
           if (mod(m, i) /= 0) exit
        end do
        ans = mod(comb(n + count - 1, count, modulo), modulo)
     end if
     i = i + 1
  end do
  if (m /= 1) then
     ans = mod(ans * n, modulo)
  end if
  print '(i0)', ans

contains

  recursive integer(8) function comb(n, k, m) result(r)
    integer(8), intent(in) :: n, k, m
    integer(8) :: nume = 1, deno = 1
    integer(8) i

    if (n - k < k) then
       r = comb(n, n - k, m)
    else
       do i = 0, k - 1
          nume = mod(nume * (n - i), m)
          deno = mod(deno * (i + 1), m)
       end do
       r = mod(nume * modpow(deno, m - 2, m), m)
    end if
  end function comb

  recursive integer(8) function modpow(a, p, m) result(r)
    integer(8), intent(in) :: a, p, m
    integer(8) h
    
    if (p == 0) then
       r = 1
    else if (mod(p, 2) == 0) then
       h = modpow(a, p / 2, m)
       r = mod(h * h, m)
    else
       r = mod(a * modpow(a, p - 1, m), m)
    end if
  end function modpow
end program abc110d
