//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (998244353)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// #define int ll

int k;
int n;

int a[1234],pre[1234];
int solve(int pos,int sofar,int left){
	if(pos==n-1){
		if(sofar>k)
			return 0;
		if(left<=0 && left+a[pos]>=0){
			return 1;
		}
		return 0;
	}
	assert(0);
	// if(visit[pos][sofar][left+offset]){
	// 	return dp[pos][sofar][left+offset];
	// }
	// visit[pos][sofar][left+offset]=1;
	// int ans=0;
	// rep(i,a[pos]){
	// 	ans+=solve(pos+1,sofar)
	// }

} 
int boo[2000][610];
int dp[610][1400];
int gao[610][1400];
int offset=608;

int getboo(int x,int y){
	if(y<0)
		return 0;
	return boo[x][y];
}
int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    string s;
    cin>>s;
    cin>>k;
    if(k==0){
    	cout<<1<<endl;
    	return 0;
    }
    n=0;
    int cnt=0;
    int i,j,pos;
    rep(i,s.length()){
    	if(s[i]=='0'){
    		a[n]=cnt;
    		cnt=0;
    		n++;
    	}
    	else{
    		cnt++;
    	}
    }
    a[n++]=cnt;
    pre[0]=a[0];
    f(i,1,n){
    	//cout<<a[0]<<endl;
    	pre[i]=a[i]+pre[i-1];
    }
    rep(i,303){
    	f(j,-303,303){
    		dp[i][j+offset]=solve(n-1,i,j);
    	}
    }
    fd(pos,n-2,0){
    	rep(i,605){
    		f(j,-605,605){
    			boo[j+i+offset][i]=getboo(j+i+offset,i-1)+dp[i][j+offset];
    			if(boo[j+i+offset][i]>=mod)
    				boo[j+i+offset][i]-=mod;
    		}
    	}
    	rep(i,605){
    		f(j,-605,605){
    			gao[i][j+offset]=gao[i][j-1+offset]+dp[i][j+offset];
    			if(gao[i][j+offset]>=mod)
    				gao[i][j+offset]-=mod;
    		}
    	}
    	//cout<<pos<<endl;
    	rep(i,302){
    		f(j,-302,1){
    			dp[i][j+offset]=boo[j+i+offset][601]-getboo(j+i+offset,i-1);
    			dp[i][j+offset]+=gao[i][j+a[pos]+offset]-gao[i][j+offset];
    			dp[i][j+offset]%=mod;
    			if(dp[i][j+offset]<0)
    				dp[i][j+offset]+=mod;
    			// if(pos==1 && dp[i][j+offset]!=0){
    			// 	//cout<<a[pos]<<endl;
    			// 	cout<<i<<" "<<j<<" "<<dp[i][j+offset]<<" "<<endl;
    			// }
    		}
    	}

    }
    cout<<dp[0][offset]<<endl;
    return 0;   
}


Measured memory_bytes: 12924