#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<ll,ll>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
ll rnd(){
	ull ans=0;
	For(i,0,4)ans=ans<<15^rand();
	return ans%((ull)1<<63);
}
const int N=10000005,mod=1e9+7;
ll n,m,fac[N],ni[N],alb[5005];
ll c(int a,int b){
	return fac[a]*ni[b]%mod*ni[a-b]%mod;
}
ll ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
ll inv(int n){
	return fac[n-1]*ni[n]%mod;
}
int main(){
	#ifdef Brollan
		freopen("1.in","r",stdin);
	#endif
	n=read(),m=read();
	For(i,fac[0]=1,n)fac[i]=fac[i-1]*i%mod;
	ni[n]=ksm(fac[n],mod-2);
	Rep(i,n,1)ni[i-1]=ni[i]*i%mod;
	n-=m;
	ll ans=0;
	For(i,0,m)alb[i]=i*inv(i+n)%mod;
	For(mn,2,m+1){
		For(i,0,mn-2){
			//cout<<n+m-i-1<<" "<<endl;
			ans=(ans+(i%2?-1:1)*c(mn-1,i)*(mn<=m?fac[n+m-i-1]:fac[n+m-i])%mod
			*alb[mn-i-1])%mod;
		}
		//cout<<ans<<endl;
	}
	cout<<(ans+mod)%mod<<endl;
	/*
	dp[0][0]=1;
	For(i,0,m-1){
		For(j,0,n){
			For(k,1,m-i){
				For(l,0,n-j){
					if(j!=n&&k+l==1)continue;
					dp[i+k][j+l]+=fac[k+l-1]*dp[i][j]*c(m-i,k)*c(n-j,l);
				}
			}
		}
	}
	cout<<dp[m][n]<<endl;
	*/
}
/*
枚举不合法1第一个位置 
mn-1不能有1 ，容斥这个条件 
mn-i-1无所谓 
m-mn无所谓
n只能连之前的 
*/