#include <bits/stdc++.h>
#define ll long long 
#define ld long double
using namespace std;
const ll INF = 1e18;
const ll MOD = 998244353;


vector<string> vec_splitter(string s) {
		s += ',';
		vector<string> res;
		while(!s.empty()) {
				res.push_back(s.substr(0, s.find(',')));
				s = s.substr(s.find(',') + 1);
		}
		return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
		if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
		stringstream ss; ss << H;
		cerr << args[idx] << " = " << ss.str();
		debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define deb(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define deb(...) 42
#endif


struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint operator~() const { return mint(1) / *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint& operator+=(const int& a){ if((x+=a)>=MOD) x-=MOD; return *this;}
  mint& operator+=(const ll& a){ if((x+=a)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const ll& a){ if((x+=MOD-a)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const int& a){ if((x+=MOD-a)>=MOD) x-=MOD; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint& operator*=(const ll& a){ (x*=a)%=MOD; return *this;}
  mint& operator*=(const int& a){ (x*=a)%=MOD; return *this;}
  mint& operator/=(const mint& a){ (x*=a.ex(MOD-2).x)%=MOD; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator+(const ll& a)const{ return mint(*this) += mint(a);}
  mint operator+(const int& a)const{ return mint(*this) += mint(a);}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator-(const ll& a)const{ return mint(*this) -= mint(a);}
  mint operator-(const int& a)const{ return mint(*this) -= mint(a);}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  mint operator*(const ll& a)const{ return mint(*this) *= mint(a);}
  mint operator*(const int& a)const{ return mint(*this) *= mint(a);}
  mint operator/(const mint& a)const{ return mint(*this) /= a;}
  mint operator/(const ll& a)const{ return mint(*this) /= mint(a);}
  mint operator/(const int& a)const{ return mint(*this) /= mint(a);}
  mint& operator=(const ll&a){ this->x = a; return (*this);}
  mint& operator=(const int&a){ this->x = a; return (*this);}
  mint ex(ll t) const {
    if(!t) return 1;
    mint res = ex(t/2);
    res *= res;
    return (t&1)?res*x:res;
  }
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
  bool operator!=(const mint& a)const{ return x != a.x;}
};

mint ex(mint x, ll t) { return x.ex(t);}
mint operator/(ll a, mint b)    {   return mint(a) / b; }
mint operator*(ll a, mint b)    {   return mint(a) * b; }
mint operator+(ll a, mint b)    {   return mint(a) + b; }
mint operator-(ll a, mint b)    {   return mint(a) - b; }
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x % MOD;return o;}

mint dp[301][301][310];

int32_t main() {
	ios::sync_with_stdio(!cin.tie(NULL));

	int n;
	string s;
	cin >> s;
	n = s.length();
	int k;
	cin >> k;

	s += '0';

	vector<int> arr(1, 0);

	int cur = 0;
	for(auto ch : s) {
		if(ch == '0') {
			arr.push_back(cur);
			cur = 0;
		}
		else {
			cur++;
		}
	}
	vector<int> pref(arr.size(), 0);
	for(int i = 1; i < (int)arr.size(); i++)	pref[i] = arr[i] + pref[i - 1];
	dp[0][0][0] = 1;

	for(int i = 0; i < (int)arr.size() - 1; i++) {
		for(int j = pref[i]; j <= pref.back(); j++) {
			for(int op = j - pref[i]; op <= pref.back(); op++) {
				for(int now = max(0, pref[i + 1] - j); now <= pref.back() - j; now++) {
					dp[i + 1][j + now][op + max(0, now - arr[i + 1])] += dp[i][j][op];
				}
			}
		}
	}
	
	mint ans = 0;
	for(int i = 0; i <= min(k, (int)pref.back()); i++) {
		ans += dp[(int)arr.size() - 1][pref.back()][i];
	}

	cout << ans;
}


Measured memory_bytes: 223072