#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <stdexcept>
#include <vector>

// lib/quo.hpp
#ifndef QUO_H
#define QUO_H

/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T quo(const T lhs, const T rhs) {
    return lhs > 0 ? lhs / rhs : rhs > 0 ? -((-lhs - 1 + rhs) / rhs) : (-lhs - 1 + -rhs) / -rhs;
  }
}

#endif

// lib/square.hpp
#ifndef SQUARE_HPP
#define SQUARE_HPP

/*
usage:

tools::square(5) => 25
*/

namespace tools {
  template <typename T>
  constexpr T square(const T x) {
    return x * x;
  }
}

#endif

// lib/floor_log2.hpp
#ifndef FLOOR_LOG2_HPP
#define FLOOR_LOG2_HPP


namespace tools {
  std::uint32_t floor_log2(std::uint32_t x);
  std::uint64_t floor_log2(std::uint64_t x);
}

#endif

// lib/bitcount.hpp
#ifndef BITCOUNT_HPP
#define BITCOUNT_HPP


namespace tools {
  std::uint32_t bitcount(std::uint32_t x);
  std::uint64_t bitcount(std::uint64_t x);
}

#endif

// lib/is_prime.hpp
#ifndef IS_PRIME_H
#define IS_PRIME_H


/*
usage:

static_assert(tools::is_prime(P), "P must be prime.");
*/

// Source: Stack Overflow ( https://stackoverflow.com/questions/18303632/compile-time-prime-checking/18306693#18306693 )
// Author: Casey ( https://stackoverflow.com/users/923854/casey )
// CC BY-SA 3.0
namespace tools {
  namespace detail {
    namespace is_prime {
      constexpr std::uint_fast32_t mid(const std::uint_fast32_t low, const std::uint_fast32_t high) {
        return (low + high) / 2;
      }

      // precondition: low*low <= n, high*high > n.
      constexpr std::uint_fast32_t ceilsqrt(const std::uint_fast32_t n, const std::uint_fast32_t low, const std::uint_fast32_t high) {
        return low + 1 >= high
          ? high
          : (mid(low, high) * mid(low, high) == n)
          ? mid(low, high)
          : (mid(low, high) * mid(low, high) <  n)
          ? ceilsqrt(n, mid(low, high), high)
          : ceilsqrt(n, low, mid(low, high));
      }

      // returns ceiling(sqrt(n))
      constexpr std::uint_fast32_t ceilsqrt(const std::uint_fast32_t n) {
        return n < 3
          ? n
          : ceilsqrt(n, 1, std::uint_fast32_t(1) << (std::numeric_limits<std::uint_fast32_t>::digits / 2));
      }

      // returns true if n is divisible by an odd integer in
      // [2 * low + 1, 2 * high + 1).
      constexpr bool find_factor(const std::uint_fast32_t n, const std::uint_fast32_t low, const std::uint_fast32_t high) {
        return low + 1 >= high
          ? (n % (2 * low + 1)) == 0
          : (find_factor(n, low, mid(low, high)) || find_factor(n, mid(low, high), high));
      }
    }
  }

  constexpr bool is_prime(const std::uint_fast32_t n) {
    return n > 1
      && (n == 2
        || (n % 2 == 1
          && (n == 3
            || !detail::is_prime::find_factor(n, 1, (detail::is_prime::ceilsqrt(n) + 1) / 2))));
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// lib/prime_sieve.hpp
#ifndef PRIME_SIEVE_HPP
#define PRIME_SIEVE_HPP


/*
// primes are all primes less than or equal to 100
std::vector<std::int_fast64_t> primes = tools::prime_sieve<std::int_fast64_t>(100);
*/

namespace tools {
  template <typename T>
  std::vector<T> prime_sieve(const T n) {
    std::vector<bool> is_prime(n + 1, true);
    is_prime[0] = false;
    is_prime[1] = false;

    const T max = static_cast<T>(std::sqrt(n));
    for (T i = 2; i <= max; ++i) {
      if (is_prime[i]) {
        for (T j = i * 2; j <= n; j += i) {
          is_prime[j] = false;
        }
      }
    }

    std::vector<T> result;
    for (T i = 0; i <= n; ++i) {
      if (is_prime[i]) {
        result.push_back(i);
      }
    }
    return result;
  }
}

#endif

// lib/mod.hpp
#ifndef MOD_HPP
#define MOD_HPP


/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T mod(const T lhs, const T rhs) {
    return lhs - quo(lhs, rhs) * rhs;
  }
}

#endif

// lib/floor_log2.cpp

namespace tools {
  std::uint32_t floor_log2(std::uint32_t x) {
    x |= (x >> static_cast<std::uint32_t>(1));
    x |= (x >> static_cast<std::uint32_t>(2));
    x |= (x >> static_cast<std::uint32_t>(4));
    x |= (x >> static_cast<std::uint32_t>(8));
    x |= (x >> static_cast<std::uint32_t>(16));
    return bitcount(x) - static_cast<std::uint32_t>(1);
  }

  std::uint64_t floor_log2(std::uint64_t x) {
    x |= (x >> static_cast<std::uint64_t>(1));
    x |= (x >> static_cast<std::uint64_t>(2));
    x |= (x >> static_cast<std::uint64_t>(4));
    x |= (x >> static_cast<std::uint64_t>(8));
    x |= (x >> static_cast<std::uint64_t>(16));
    x |= (x >> static_cast<std::uint64_t>(32));
    return(bitcount(x) - static_cast<std::uint64_t>(1));
  }
}

// lib/bitcount.cpp

namespace tools {
  std::uint32_t bitcount(std::uint32_t x) {
    x = (x & static_cast<std::uint32_t>(0x55555555ull)) + (x >> static_cast<std::uint32_t>(1) & static_cast<std::uint32_t>(0x55555555ull));
    x = (x & static_cast<std::uint32_t>(0x33333333ull)) + (x >> static_cast<std::uint32_t>(2) & static_cast<std::uint32_t>(0x33333333ull));
    x = (x & static_cast<std::uint32_t>(0x0f0f0f0full)) + (x >> static_cast<std::uint32_t>(4) & static_cast<std::uint32_t>(0x0f0f0f0full));
    x = (x & static_cast<std::uint32_t>(0x00ff00ffull)) + (x >> static_cast<std::uint32_t>(8) & static_cast<std::uint32_t>(0x00ff00ffull));
    return (x & static_cast<std::uint32_t>(0x0000ffffull)) + (x >> static_cast<std::uint32_t>(16) & static_cast<std::uint32_t>(0x0000ffffull));
  }

  std::uint64_t bitcount(std::uint64_t x) {
    x = (x & static_cast<std::uint64_t>(0x5555555555555555ull)) + (x >> static_cast<std::uint64_t>(1) & static_cast<std::uint64_t>(0x5555555555555555ull));
    x = (x & static_cast<std::uint64_t>(0x3333333333333333ull)) + (x >> static_cast<std::uint64_t>(2) & static_cast<std::uint64_t>(0x3333333333333333ull));
    x = (x & static_cast<std::uint64_t>(0x0f0f0f0f0f0f0f0full)) + (x >> static_cast<std::uint64_t>(4) & static_cast<std::uint64_t>(0x0f0f0f0f0f0f0f0full));
    x = (x & static_cast<std::uint64_t>(0x00ff00ff00ff00ffull)) + (x >> static_cast<std::uint64_t>(8) & static_cast<std::uint64_t>(0x00ff00ff00ff00ffull));
    x = (x & static_cast<std::uint64_t>(0x0000ffff0000ffffull)) + (x >> static_cast<std::uint64_t>(16) & static_cast<std::uint64_t>(0x0000ffff0000ffffull));
    return (x & static_cast<std::uint64_t>(0x00000000ffffffffull)) + (x >> static_cast<std::uint64_t>(32) & static_cast<std::uint64_t>(0x00000000ffffffffull));
  }
}

// lib/prime_factorization.hpp
#ifndef PRIME_FACTORIZATION_HPP
#define PRIME_FACTORIZATION_HPP


namespace tools {
  template <typename T>
  std::map<T, T> prime_factorization(T n) {
    std::map<T, T> result;
    for (const T& p : prime_sieve(static_cast<T>(std::sqrt(n)))) {
      while (n % p == static_cast<T>(0)) {
        ++result[p];
        n /= p;
      }
    }
    if (n > static_cast<T>(1)) {
      ++result[n];
    }
    return result;
  }
}

#endif

// lib/int_mod.hpp
#ifndef INT_MOD_HPP
#define INT_MOD_HPP


/*
usage:

constexpr const std::uint_fast32_t p = 3;
tools::int_mod<p>(5) + tools::int_mod<p>(4) // => 0
*/

namespace tools {
  template <std::uint_fast32_t P>
  class int_mod {
    static_assert(is_prime(P), "P must be prime.");

  private:
    std::uint_fast32_t m_value;

    constexpr static std::uint_fast32_t add_impl(const std::uint_fast32_t lhs, const std::uint_fast32_t rhs) {
      return (lhs + rhs) % P;
    }

    constexpr static std::uint_fast32_t sub_impl(const std::uint_fast32_t lhs, const std::uint_fast32_t rhs) {
      return (lhs - rhs + P) % P;
    }

    constexpr static std::uint_fast32_t mul_impl(const std::uint_fast32_t lhs, const std::uint_fast32_t rhs) {
      return static_cast<std::uint_fast32_t>(static_cast<std::uint_fast64_t>(lhs) * static_cast<std::uint_fast64_t>(rhs) % static_cast<std::uint_fast64_t>(P));
    }

    constexpr int_mod<P> pow_impl(const std::uint_fast32_t exponent) const {
      return exponent == 0
        ? int_mod<P>(1)
        : exponent % 2 == 0
          ? square(this->pow_impl(exponent / 2))
          : this->pow_impl(exponent - 1) * *this;
    }

  public:
    int_mod() :
      m_value(0) {
    }

    int_mod(const std::int_fast32_t value) :
      m_value(static_cast<std::uint_fast32_t>(mod(value, static_cast<std::int_fast32_t>(P)))) {
    }

    int_mod(const int_mod<P>& other) :
      int_mod(other.m_value) {
    }

    constexpr operator std::uint_fast32_t() const {
      return m_value;
    }

    constexpr friend int_mod<P> operator+(const int_mod<P>& lhs, const int_mod<P>& rhs) {
      return int_mod<P>(int_mod<P>::add_impl(lhs.m_value, rhs.m_value));
    }

    int_mod<P>& operator+=(const int_mod<P>& other) {
      m_value = int_mod<P>::add_impl(m_value, other.m_value);
      return *this;
    }

    constexpr friend int_mod<P> operator-(const int_mod<P>& lhs, const int_mod<P>& rhs) {
      return int_mod<P>(int_mod<P>::sub_impl(lhs.m_value, rhs.m_value));
    }

    int_mod<P>& operator-=(const int_mod<P>& other) {
      m_value = int_mod<P>::sub_impl(m_value, other.m_value);
      return *this;
    }

    constexpr friend int_mod<P> operator*(const int_mod<P>& lhs, const int_mod<P>& rhs) {
      return int_mod<P>(int_mod<P>::mul_impl(lhs.m_value, rhs.m_value));
    }

    int_mod<P>& operator*=(const int_mod<P>& other) {
      m_value = int_mod<P>::mul_impl(m_value, other.m_value);
      return *this;
    }

    constexpr int_mod<P> inv() const {
      return m_value > 0
        ? this->pow_impl(P - 2)
        : (throw std::invalid_argument("cannot divide by zero"));
    }

    constexpr int_mod<P> pow(const std::int_fast32_t exponent) const {
      return exponent >= 0
        ? this->pow_impl(static_cast<std::uint_fast32_t>(exponent))
        : this->pow_impl(static_cast<std::uint_fast32_t>(-exponent)).inv();
    }

    constexpr friend int_mod<P> operator/(const int_mod<P>& lhs, const int_mod<P>& rhs) {
      return lhs * rhs.inv();
    }

    int_mod<P>& operator/=(const int_mod<P>& other) {
      m_value = int_mod<P>::mul_impl(m_value, other.inv().m_value);
      return *this;
    }
  };
}

#endif

// lib/fact_mod_cache.hpp
#ifndef FACT_MOD_CACHE_HPP
#define FACT_MOD_CACHE_HPP


/*
usage:

tools::fact_mod_cache<3> cache(5);
cache.fact(5); //=> 0 (5! mod 3)
*/

namespace tools {
  template <std::uint_fast32_t P>
  class fact_mod_cache {
  private:
    std::size_t m_max;
    std::vector<int_mod<P>> m_data;
    std::vector<int_mod<P>> m_inv_data;

  public:
    fact_mod_cache(const std::size_t max) :
      m_max(max),
      m_data(max + 1),
      m_inv_data(max + 1) {
      m_data[0] = int_mod<P>(1);
      for (std::size_t i = 1; i <= max; ++i) {
        m_data[i] = m_data[i - 1] * int_mod<P>(static_cast<std::int_fast32_t>(i));
      }
      m_inv_data[max] = m_data[max].inv();
      for (std::size_t i = max - 1; i != std::numeric_limits<std::size_t>::max(); --i) {
        m_inv_data[i] = m_inv_data[i + 1] * int_mod<P>(static_cast<std::int_fast32_t>(i + 1));
      }
    }

    constexpr int_mod<P> fact(const std::size_t i) const {
      return m_data[i];
    }

    constexpr int_mod<P> inv_fact(const std::size_t i) const {
      return m_inv_data[i];
    }

    constexpr int_mod<P> combination(const std::size_t n, const std::size_t r) const {
      return m_data[n] * m_inv_data[n - r] * m_inv_data[r];
    }
  };
}

#endif

// main.cpp

int main() {
  constexpr u32 P = 1000000007;
  u32 N, M;
  std::cin >> N >> M;

  tools::fact_mod_cache<P> cache(N + tools::floor_log2(M) - 1);

  tools::int_mod<P> answer(1);
  for (const std::pair<u32, u32>& pair : tools::prime_factorization(M)) {
    answer *= cache.combination(N + pair.second - 1, pair.second);
  }

  std::cout << static_cast<u32>(answer) << std::endl;
  return 0;
}

Measured memory_bytes: 1920