#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 998244353;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

template<u32 M = 1000000007>
struct modint{
    u32 val;
    modint(): val(0){}
    template<typename T>
    modint(T t){t %= (T)M; if(t < 0) t += (T)M; val = t;}

    modint pow(ll k) const {
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T t){t %= (T)M; if(t < 0) t += (T)M; val = t; return *this;}
    modint inv() const {return pow(M-2);}
    modint& operator+=(modint a){val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){if(val < a.val) val += M-a.val; else val -= a.val; return *this;}
    modint& operator*=(modint a){val = (u64)val*a.val%M; return *this;}
    modint& operator/=(modint a){return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){return modint(M-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
};
using mint = modint<MOD>;

int main() {
    string s; int K;
    cin >> s >> K;
    int m = s.size();
    reverse(s.begin(),s.end());
    vector<int> v;
    int val = 0, cnt = 0;
    for (auto &&i : s) {
        if(i == '0'){
            v.emplace_back(val);
            val = 0;
        }else {
            val++;
        }
    }
    v.emplace_back(val);
    int n = v.size();
    auto dp1 = make_v(n+1, m+1, m+1, mint(0)), dp2 = make_v(n+1, m+1, m+1, mint(0));
    dp1[0][0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= m; ++j) {
            for (int k = 0; k <= m; ++k) {
                dp1[i+1][j][k] += dp1[i][j][k];
                int x = min(max(j+v[i]+1, k+v[i]+1), m+1);
                if(x != m+1) dp1[i+1][j+v[i]+1][k+v[i]+1] -= dp1[i][j][k];
                dp2[i+1][0][k] += dp1[i][j][k];
                dp2[i+1][j][k] -= dp1[i][j][k];
            }
        }
        for (int j = 0; j <= m; ++j) {
            for (int k = 0; k <= m; ++k) {
                if(j && k) dp1[i+1][j][k] += dp1[i+1][j-1][k-1];
                if(j) dp2[i+1][j][k] += dp2[i+1][j-1][k];
            }
        }
        for (int j = 0; j <= m; ++j) {
            for (int k = 0; k <= m; ++k) {
                dp1[i+1][j][k] += dp2[i+1][j][k];
            }
        }
    }
    mint ans = 0;
    for (int k = 0; k <= min(K, m); ++k) {
        ans += dp1.back()[0][k];
    }
    cout << ans.val << "\n";
    return 0;
}

Measured memory_bytes: 222176