#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

const long long mod = 998244353;
char S[303]; int K; long long D[303][606], P[303][606];

void add(long long& a, long long b)
{
	a += b;
	if (a >= mod)
		a -= mod;
}

int main()
{
	scanf ("%s", S);
	scanf ("%d", &K);

	int cnt = 0;
	vector<int> v;
	for (int i = 0; S[i]; i++){
		if (S[i] == '1') cnt++;
		else{
			v.push_back(cnt);
			cnt = 0;
		}
	}
	v.push_back(cnt);

	D[0][0] = 1;
	int s = 0;
	while (!v.empty()){
		int a = v.back(); v.pop_back(); s += a;
		for (int b = 0; b <= s; b++){
			int m = abs(a - b);
			for (int j = 0; j <= s; j++) if (j + a - b >= 0){
				for (int k = 0; k <= s * 2; k++){
					add(P[j + a - b][k + m], D[j][k]);
				}
			}
		}
		for (int j = 0; j <= s; j++) for (int k = 0; k <= s * 2; k++){
			D[j][k] = P[j][k];
			P[j][k] = 0;
		}
	}

	long long ans = 0;
	for (int k = 0; k <= s * 2; k += 2) if (k / 2 <= K){
		add(ans, D[0][k]);
	}
	printf ("%lld\n", ans);

	return 0;
}