#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 303
const int mod=998244353;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,m,gu,dp[N][N][N],a[N],ans,sum[N],s1[N][N],s2[N<<1][N<<1];
char s[N];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1),m=read();
	s[++n]='0';
	m=min(n,m);
	for(int i=1;i<=n;++i){
		if(s[i]=='0')++gu;
		else ++a[gu+1];
	}
	for(int i=1;i<=gu;++i){
		sum[i]=a[i]+sum[i-1];
	}
	dp[0][0][0]=1;
	for(int i=1;i<=gu;++i){
		for(int k=0;k<=m;++k){
			s1[0][k]=dp[i-1][0][k];
			for(int j=1;j<=n-gu;++j){
				s1[j][k]=(s1[j-1][k]+dp[i-1][j][k])%mod;
			}
		}
		for(int k=sum[i]-a[i];k<=n-gu+min(n-gu,m)-a[i];++k){
			s2[k][0]=dp[i-1][0][k]%mod;
			for(int p=1;p<=k;++p){
				s2[k][p]=(s2[k][p-1]+dp[i-1][p][k-p])%mod;
			}
		}
		for(int j=sum[i];j<=n-gu;++j){
			int lim=min(j,n-sum[i-1]-gu);
			if(lim>a[i]){
				for(int k=0;k<=min(j,m);++k){
					dp[i][j][k]=1LL*(s1[j-(a[i]+1)][k]-s1[j-lim-1][k]+mod)%mod;
				}
			}
			for(int k=0;k<=min(j,m);++k){
				dp[i][j][k]=(dp[i][j][k]+s2[j+k-a[i]][j-max(0,a[i]-k)]-s2[j+k-a[i]][j-a[i]-1])%mod;
				dp[i][j][k]=(dp[i][j][k]<0?dp[i][j][k]+mod:dp[i][j][k]);
			}
		}
	}
	for(int k=0;k<=m;++k){
		ans=(ans+dp[gu][n-gu][k])%mod;
	}
	cout<<ans<<endl;
	return 0;
}


// FUCKED UP FUCKED UP FUCKED UP FUCKED UP FUCKED UP
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=3e2+10, maxm=5e4+10, lg=21, mod=998244353, inf=1e18;

string s;
ll k,n,cnt,a[maxn],d[maxn],dp[maxn][maxn][maxn];

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>s>>k;
	for(char c:s) (c=='0' ? cnt++:a[n++]=cnt);
	k=min(k,n);
	for(int i=0;i<n;i++) d[a[i]]++;
	dp[cnt+1][0][0]=1;
	for(int i=cnt+1;i;i--)for(int j=0;j<=k;j++)for(int k=0;k<=n;k++)if(dp[i][j][k])for(int t=0;t<=d[i-1]+k;t++) (dp[i-1][j+max(0ll,d[i-1]-t)][d[i-1]+k-t]+=dp[i][j][k])%=mod;
	ll ans=0;
	for(int i=0;i<=k;i++) ans+=dp[0][i][0];
	cout<<ans%mod;
	
	return 0;
}



 
