#include<cstdio>
#include<algorithm>
#define maxn 1001
#define mod 5201314
using namespace std;
typedef long long ll;
//固定一位or把最高位插入
ll f[maxn][maxn]={0};
int main(){
freopen("sky_num.in","r",stdin);
freopen("sky_num.out","w",stdout);
int n,k;
scanf("%d%d",&n,&k);
for (int i=1;i<=n;i++){
f[i][0]=1;
for (int j=1;j<=n;j++){
f[i][j]=(f[i-1][j-1]*(i-j)+f[i-1][j]*(j+1))%mod;
}
}
printf("%lld",f[n][k]);
return 0;
}