#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int re()
{
int f=1,num=0;
char c=getchar();
while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
while(c>='0'&&c<='9') num=num*10+c-'0',c=getchar();
return num*f;
}
const int MOD=1e9+7;
int a=1,m;
signed main()
{
freopen("LCG.in","r",stdin);
freopen("LCG.out","w",stdout);
re();m=re();
for(int i=2;i<m;i++) a=a*i%MOD;
printf("%lld",a);
return 0;
}