#include <bits/stdc++.h>
 
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

template<int MOD> struct modnum {
    int v;
    modnum() : v(0) {}
    modnum(ll _v) : v(_v % MOD) { if (v < 0) v += MOD; }
    explicit operator int() const { return v; }
    friend istream& operator >> (istream& i, modnum& n) { ll v; i >> v; n = modnum(v); return i; }
    friend ostream& operator << (ostream& o, const modnum& n) { return o << n.v; }

    friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
    friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

    modnum& operator += (const modnum& o) { v += o.v; if (v >= MOD) v -= MOD; return *this; }
    modnum& operator -= (const modnum& o) { v -= o.v; if (v < 0) v += MOD; return *this; }
    modnum& operator *= (const modnum& o) { v = int(ll(v) * ll(o.v) % MOD); return *this; }
    modnum operator - () { modnum res; if (v) res.v = MOD - v; return res; }
    friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
    friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
    friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }

    modnum pow(ll e) const {
        if (e == 0) return 1;
        if (e & 1) return *this * this->pow(e-1);
        return (*this * *this).pow(e/2);
    }

    modnum inv() const {
        int g = MOD, x = 0, y = 1;
        for (int r = v; r != 0; ) {
            int q = g / r;
            g %= r; swap(g, r);
            x -= q * y; swap(x, y);
        }

        assert(g == 1);
        assert(y == MOD || y == -MOD);
        return x < 0 ? x + MOD : x;
    }
    modnum& operator /= (const modnum& o) { return (*this) *= o.inv(); }
    friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= modnum(b); }

    static int totient() {
        int tot = MOD, tmp = MOD;
        for (int p = 2; p * p <= tmp; p++) if (tmp % p == 0) {
            tot = tot / p * (p - 1);
            while (tmp % p == 0) tmp /= p;
        }
        if (tmp > 1) tot = tot / tmp * (tmp - 1);
        return tot;
    }

    static int primitive_root() {
        if (MOD == 1) return 0;
        if (MOD == 2) return 1;

        int tot = totient(), tmp = tot;
        vi tot_pr;
        for (int p = 2; p * p <= tmp; p++) if (tot % p == 0) {
            tot_pr.push_back(p);
            while (tmp % p == 0) tmp /= p;
        }
        if (tmp > 1) tot_pr.push_back(tmp);

        for (int r = 2; r < MOD; r++) if (__gcd(r, MOD) == 1) {
            bool root = true;
            for (int p : tot_pr) root &= modnum(r).pow(tot / p) != 1;
            if (root) return r;
        }
        assert(false);
    }

    static modnum generator() { static modnum g = primitive_root(); return g; }
    static int discrete_log(modnum v) {
        static const int M = ceil(sqrt(MOD));
        static unordered_map<int, int> table;
        if (table.empty()) {
            modnum e = 1;
            for (int i = 0; i < M; i++) { table[e.v] = i; e *= generator(); }
        }
        static modnum f = generator().pow(totient() - M);

        for (int i = 0; i < M; i++) {
            if (table.count(v.v)) return table[v.v] + i * M;
            v *= f;
        }
        assert(false);
    }

    static modnum fact(int n) {
        static vector<modnum<MOD>> fact = { 1 };
        for (assert(n >= 0); fact.size() <= n; )
            fact.push_back(fact.back() * fact.size());
        return fact[n];
    }

    static modnum finv(int n) {
        static vector<modnum<MOD>> finv = { 1 };
        for (assert(n >= 0); finv.size() <= n; )
            finv.push_back(finv.back() / finv.size());
        return finv[n];
    }

    static modnum ncr(int n, int r) {
        if (r < 0 || n < r) return 0;
        return fact(n) * finv(r) * finv(n - r);
    }
};

constexpr ll MOD = 998244353;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string S;
    ll K;
    cin >> S >> K;

    int N = S.length();

    vi runs;
    int cur = 0;
    for (int i=0;i<N;i++) {
        if (S[i] == '0') {
            runs.pb(cur);
            cur = 0;
        } else {
            cur++;
        }
    } 

    runs.pb(cur);
    int R = sz(runs);

    int A = 0;
    for (int r : runs) A += r;

    vi partials(R+1, 0);
    for (int i=0;i<R;i++) partials[i+1] = partials[i] + runs[i];

    // for (int r : runs) cout << r << " ";
    // cout << endl;

    vector<modnum<MOD>> dprow(2*A+1, 0);
    vector<vector<modnum<MOD>>> dprow2(A+1, dprow);
    vector<vector<vector<modnum<MOD>>>> dp(R+1, dprow2);
    // vector<vector<vector<modnum<MOD>>>> dptrue(R+1, dprow2);

    vector<modnum<MOD>> diagrow(3*A+1, 0);
    vector<vector<modnum<MOD>>> diagrow2(A+1, diagrow);
    vector<vector<vector<modnum<MOD>>>> diag1(R+1, diagrow2);
    vector<vector<vector<modnum<MOD>>>> diag2(R+1, diagrow2);



    // dptrue[0][0][0] = 1;

    dp[0][0][0] = 1;
    diag1[0][0][0] = 1;
    diag2[0][0][2*A] = 1;

    for (int s=1;s<=A;s++) {
        for (int r=0;r<=3*A;r++) {
            diag1[0][s][r] += diag1[0][s-1][r];
            diag2[0][s][r] += diag2[0][s-1][r];
        }
    }

    for (int i=0;i<R;i++) {
        for (int s=partials[i+1];s<=A;s++) {
            for (int b=0;b<=2*A;b++) {
                int r1 = s + b - runs[i];
                int r2 = s - b - runs[i] + 2*A;

                if (r1 >= 0 && r1 <= 3*A) {
                    dp[i+1][s][b] += diag1[i][s][r1] - diag1[i][s-runs[i]][r1];
                }

                if (r2 >= 0 && r2 <= 3*A) {
                    dp[i+1][s][b] += diag2[i][s-runs[i]][r2];
                }

                // for (int k=max(0, partials[i+1]-s);k<=A-s;k++) {
                //     if (i+1 == R && k > runs[R-1]) break;

                //     int ns = s+k;
                //     int nb = b + abs(runs[i] - k);

                //     if (nb > 2*A) continue;

                //     dptrue[i+1][ns][nb] += dptrue[i][s][b];
                // }
            }
        }

        for (int s=0;s<=A;s++) {
            for (int b=0;b<=2*A;b++) {
                int r1 = s+b;
                int r2 = s-b+2*A;
                diag1[i+1][s][r1] += dp[i+1][s][b];
                diag2[i+1][s][r2] += dp[i+1][s][b];
            }
        }

        // accumulate
        for (int s=1;s<=A;s++) {
            for (int r=0;r<=3*A;r++) {
                diag1[i+1][s][r] += diag1[i+1][s-1][r];
                diag2[i+1][s][r] += diag2[i+1][s-1][r];
            }
        }
        
    }

    modnum<MOD> ans = 0;
    for (int b=0;b<=2*A;b++) {
        if (b<=2*K) ans += dp[R][A][b];
    }

    cout << ans << endl;

    // for (int i=0;i<=R;i++) {
    //     cout << i << " (i): " << endl;
    //     for (int s=0;s<=A;s++) {
    //         cout << "\t" << s << " (s): " << endl;
    //         for (int b=0;b<=2*A;b++) {
    //             cout << "\t\t" << b << " (b): " << dptrue[i][s][b] << "~" << dp[i][s][b] << endl;
    //         }
    //     }
    // }

    return 0;
}


Measured memory_bytes: 131208