#include<bits/stdc++.h>
using namespace std;
int a[505],b[505];
int main() {
	freopen("employ.in","r",stdin);
	freopen("employ.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
		b[i]=i;
	}
	if(n<=18) {
		long long ans=0;
		do {
			int cnt=0;
			int tmp=0;
			for(int i=1; i<=n; i++) {
				if(s[i-1]=='0') {
					tmp++;
				} else {
					if(tmp>=a[b[i]]) {
						tmp++;
					} else cnt++;
				}
			}
			if(cnt>=m)ans++;
		} while(next_permutation(b+1,b+n+1));
		cout<<ans;
	} else {
		long long ans=1;
		for(int i=1; i<=n; i++) {
			ans=(ans*i)%998244353;
		}
		cout<<ans;
	}
	return 0;
}

