#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
string s;
ll k, w;
ll mod = 998244353;
ll noone, nozero;

ll memo[305][305][2];
ll arr[305];

ll rs[305][305];
ll rs2[605][305];
ll temprs[605][305];
ll temprs2[605][305];

ll power(ll a, ll b){
	a %= mod;
	if (b == 0) return 1;
	if (b == 1) return a;
	ll half = power(a, b/2);
	half *= half;
	half %= mod;
	if (b % 2 == 1){
		half *= a;
		half %= mod;
	}
	return half;
}

ll f[1005];
ll invf[1005];
void init(){
	f[0] = 1;
	for (ll i = 1; i <= 1004; i++){
		f[i] = f[i - 1]*i;
		f[i] %= mod;
	}
	for (ll i = 0; i <= 1004; i++){
		invf[i] = power(f[i], mod - 2);
	}
}

ll choose(ll n, ll k){
	if (n < k) return 0;
	ll ans = f[n]*invf[k];
	ans %= mod;
	ans *= invf[n - k];
	return ans%mod;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	cin >> k;
	noone = 0;
	REP(i, 0, s.length()){
		if (s[i] == '1') noone++;
	}
	nozero = s.length() - noone;
	if (k >= noone){
		k = noone;
	}
	/*if (k >= noone){
		init();
		//all the ones are able to move freely
		ll nt = 0;
		for (int i = s.length() - 1; i >= 0; i--){
			if (s[i] == '1') nt++;
			else break;
		}
		ll answer = 0;
		for (ll i = nt; i >= 0; i--){
			//leave i ones at the back
			ll remaining = noone - i;
			answer += choose(remaining + nozero - 1, nozero - 1);
			answer %= mod;
		}
		cout << answer << endl;
		return 0;
	}*/
	memset(memo, -1, sizeof(memo));
	
	REP(i, 0, s.length()){
		if (s[i] == '0'){
			w++;
		} else {
			arr[w]++;
		}
	}
	w++;
	//cout << dp(0, k, w - 1) << endl;
	
	for (ll xx = 0; xx <= w - 1; xx++){
		ll x = xx%2;
		memset(temprs, 0, sizeof(temprs));
		memset(temprs2, 0, sizeof(temprs2));
		for (ll kk = 0; kk <= k; kk++){
			for (ll cur = 0; cur <= k-kk; cur++){
				if (xx == 0){
					memo[cur][kk][x] = 1;
					temprs[cur][kk] += 1;
					temprs[cur][kk] %= mod;
					temprs2[cur+kk][kk]+=1;	
					temprs2[cur+kk][kk] %= mod;				
					continue;
				}
				ll ans = 0;
				ans += rs[cur][kk];
				ans %= mod;
				//for (int i = 0; i <= cur; i++){
				//	ans += memo[cur - i][kk][1 - x]; 
					
					//distribute i here
				//	ans %= mod;					
				//}
				if (kk > arr[xx]){
					ans += rs2[cur+kk][kk - 1] - rs2[cur+kk][kk - arr[xx] - 1];
					ans %= mod;
					ans += mod;
				} else {
					ans += rs2[cur+kk][kk - 1];
				}
				ans %= mod;
				//for (int i = 1; i <= min(kk, arr[xx]); i++){
				//	ans += memo[cur + i][kk - i][1 - x];
				//	ans %= mod;
				//}
				memo[cur][kk][x] = ans;
				temprs[cur][kk] += ans;
				temprs[cur][kk] %= mod;
				temprs2[cur+kk][kk]+=ans;
				temprs2[cur+kk][kk]%=mod;
			}
		}
		for (ll cur = 0; cur <= k; cur++){
			for (ll j = 0; j <= k; j++){
				if (cur == 0){
					rs[cur][j] = temprs[cur][j];
				} else {
					rs[cur][j] = temprs[cur][j] + rs[cur - 1][j];
					rs[cur][j] %= mod;
				}
			}
		}
		for (ll i = 0; i <= 2*k; i++){
			for (ll j = 0; j <= k; j++){
				if (j == 0){
					rs2[i][j] = temprs2[i][j];
				} else {
					rs2[i][j] = temprs2[i][j] + rs2[i][j - 1];
					rs2[i][j] %= mod;
				}
			}
		}
	}
	cout << memo[0][k][(w - 1)%2] << endl;

	
}

Measured memory_bytes: 10012