#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
template<typename T = int, T mod = 1'000'000'007, typename U = long long>
struct umod{
    T val;
    umod(): val(0){}
    umod(U x){ x %= mod; if(x < 0) x += mod; val = x;}
    umod& operator += (umod oth){ val += oth.val; if(val >= mod) val -= mod; return *this; }
    umod& operator -= (umod oth){ val -= oth.val; if(val < 0) val += mod; return *this; }
    umod& operator *= (umod oth){ val = ((U)val) * oth.val % mod; return *this; }
    umod& operator /= (umod oth){ return *this *= oth.inverse(); }
    umod& operator ^= (U oth){ return *this = pwr(*this, oth); }
    umod operator + (umod oth) const { return umod(*this) += oth; }
    umod operator - (umod oth) const { return umod(*this) -= oth; }
    umod operator * (umod oth) const { return umod(*this) *= oth; }
    umod operator / (umod oth) const { return umod(*this) /= oth; }
    umod operator ^ (long long oth) const { return umod(*this) ^= oth; }
    bool operator < (umod oth) const { return val < oth.val; }
    bool operator > (umod oth) const { return val > oth.val; }
    bool operator <= (umod oth) const { return val <= oth.val; }
    bool operator >= (umod oth) const { return val >= oth.val; }
    bool operator == (umod oth) const { return val == oth.val; }
    bool operator != (umod oth) const { return val != oth.val; }
    umod pwr(umod a, U b) const { umod r = 1; for(; b; a *= a, b >>= 1) if(b&1) r *= a; return r; }
    umod inverse() const {
        U a = val, b = mod, u = 1, v = 0;
        while(b){
            U t = a/b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        if(u < 0)
            u += mod;
        return u;
    }
};
using U = umod<int, 998244353>;
template<typename U>
struct NCR {
    vector<U> fact, ifact;
    NCR(int size){
        fact.resize(size + 1); ifact.resize(size + 1);
        fact[0] = 1;
        for(int i = 1; i <= size; i++) fact[i] = fact[i - 1] * i;
        ifact[size] = fact[size].inverse();
        for(int i = size - 1; i >= 0; i--) ifact[i] = ifact[i + 1] * (i + 1);
    }
    U ncr(int n, int r){
        if(n < r) return 0;
        return fact[n] * ifact[r] * ifact[n - r];
    }
};
using N = NCR<U>;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	N kt(20000);
	string s; cin >> s;
	int K; cin >> K;
	while(s.size() > 0 && s[0] == '1') s.erase(s.begin());
	while(s.size() > 0 && s.back() == '0') s.pop_back();
	if(s.empty()){
		cout << 1 << '\n';
		return 0;
	}
	s = "0" + s + "0";
	int n = s.size();
	K = min(K, n);	
	vector<int> g, at;
	for(int i = 0; i < n; i++){
		if(s[i] == '0') at.push_back(i);
	}
	for(int i = 0; i + 1 < at.size(); i++){
		g.push_back(at[i + 1] - at[i] - 1);
	}
	int lim = 2 * n + 4;
	auto f = create<U>(n + 2, 2 * K + 1);
	f[0][0] = 1;
	reverse(g.begin(), g.end());
	int all = 0;
	for(int G : g){
		auto nf = create<U>(n + 2, 2 * K + 1);
		for(int i = 0; i <= all; i++){
			for(int j = 0; j <= 2 * K; j++){
				for(int k = 0; i + k <= all + G; k++){
					if(j + abs(k - G) <= 2 * K)
						nf[i + k][j + abs(k - G)] += f[i][j];
				}
			}
		}
		all += G;
		f = nf;
	}
	U ans = 0;
	for(int j = 0; j <= 2 * K; j++){
		int i = all;
		ans += f[i][j];
	}
	cout << ans.val << '\n';
	return 0;
}


Measured memory_bytes: 4824