#include<bits/stdc++.h>
using namespace std;
int n,m;
string s;int cnt=0;
long long rec[505];
int main(){
	freopen("employ.in","r",stdin);
	freopen("employ.out","w",stdout);
	cin>>n>>m;
	cin>>s;
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		if(!a) cnt++;
	}
	//cout<<cnt<<"\n";
	rec[0]=1;
	for(int i=1;i<=n;i++){
		rec[i]=rec[i-1]*i%998244353;
	}
	cout<<rec[n]%998244353;
	return 0;
}

