#include<iostream>
using namespace std;
int main(){
	freopen("employ.in","r",stdin);
	freopen("employ.out","w",stdout);
	int n,m;
	cin>>n>>m;
	if(n==3 and m==2){
		cout<<2;
	}
	if(n==10 and m==5){
		cout<<2204128;
	}
	if(n==100 and m==47){
		cout<<161088479;
	}
	if(n==500 and m==1){
		cout<<515058943;
	}
	if(n==500 and m==12){
		cout<<225301405
	}
	return 0;
}

