// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef int ll;

typedef long long int li;

const ll MAXN=2e5+51,MOD=1e9+7;

ll cnt,num,ftot,res=1;

ll fact[MAXN],finv[MAXN],factor[MAXN],exponent[MAXN];

inline ll read()

{

    register ll num=0,neg=1;

    register char ch=getchar();

    while(!isdigit(ch)&&ch!='-')

    {

        ch=getchar();

    }

    if(ch=='-')

    {

        neg=-1;

        ch=getchar();

    }

    while(isdigit(ch))

    {

        num=(num<<3)+(num<<1)+(ch-'0');

        ch=getchar();

    }

    return num*neg;

}

inline ll qpow(ll base,ll exponent)

{

	ll res=1;

	while(exponent)

	{

		if(exponent&1)

		{

			res=(li)res*base%MOD;

		}

		base=(li)base*base%MOD,exponent>>=1;

	}

	return res;

}

inline void setup(ll cnt)

{

	fact[0]=fact[1]=finv[0]=1;

	for(register int i=2;i<=cnt;i++)

	{

		fact[i]=(li)fact[i-1]*i%MOD;

	}

	finv[cnt]=qpow(fact[cnt],MOD-2);

	for(register int i=cnt-1;i;i--)

	{

		finv[i]=(li)finv[i+1]*(i+1)%MOD;

	}

}

inline void getFact(ll num)

{

	for(register int i=2;i<=sqrt(num);i++)

	{

		if(num%i==0)

		{

			factor[++ftot]=i;

			while(num%i==0)

			{

				num/=i,exponent[ftot]++;

			}

		}

	}

	if(num!=1)

	{

		factor[++ftot]=num,exponent[ftot]=1;

	}

}

int main()

{

	cnt=read(),getFact(num=read()),setup(200000);

	for(register int i=1;i<=ftot;i++)

	{

		res=(li)res*fact[cnt+exponent[i]-1]%MOD;

		res=(li)res*finv[cnt-1]%MOD*finv[exponent[i]]%MOD;

	}

	printf("%d\n",res);

}


// Faster C++ solution for the same problem (measured speedup: 1.4465694275985908x):
// ===================================

//   author: M_sea

//   website: http://m-sea-blog.com/

// ===================================

#include <algorithm>

#include <iostream>

#include <cstdlib>

#include <cstring>

#include <cstdio>

#include <vector>

#include <cmath>

#define re register

using namespace std;



inline int read() {

    int X=0,w=1; char c=getchar();

    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }

    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();

    return X*w;

}



const int N=100000+10;

const int mod=1000000007;

inline int qpow(int a,int b) { int c=1;

    for (;b;b>>=1,a=1ll*a*a%mod) if (b&1) c=1ll*c*a%mod;

    return c;

}



int n,m;

int v[N],cnt=0;

int dp[32][N];



int fac[N],ifac[N];

inline void init(int n) {

    fac[0]=1;

    for (re int i=1;i<=n;++i) fac[i]=1ll*fac[i-1]*i%mod;

    ifac[n]=qpow(fac[n],mod-2);

    for (re int i=n;i;--i) ifac[i-1]=1ll*ifac[i]*i%mod;

}

inline int C(int n,int m) {

    if (n<m) return 0;

    return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;

}



int main() { init(1e5);

    n=read(),m=read();

    if (m==1) { puts("1"); return 0; }

    for (re int i=1;i*i<=m;++i) {

        if (m%i==0) {

            v[++cnt]=i;

            if (i*i!=m) v[++cnt]=m/i;

        }

    }

    sort(v+1,v+cnt+1); dp[0][1]=1;

    for (re int i=1;i<=min(n,31);++i)

        for (re int j=1;j<=cnt;++j)

            for (re int k=1;k<=j&&v[k]*2<=v[j];++k)

                if (v[j]%v[k]==0)

                    dp[i][j]=(dp[i][j]+dp[i-1][k])%mod;

    int ans=0;

    for (re int i=1;i<=min(n,31);++i)

        ans=(ans+1ll*C(n,i)*dp[i][cnt])%mod;

    printf("%d\n",ans);

    return 0;

}