#include <bits/stdc++.h>
using namespace std;
using lint         = long long;
constexpr lint inf = 1LL << 60;
constexpr lint mod = 998244353;

template <lint mod>
struct modint {
    lint v;
    constexpr modint(lint t = 0) noexcept {
        v = t % mod;
        if (v < 0)
            v += mod;
    }
    constexpr modint pow(lint k) noexcept {
        modint res(1), tmp(v);
        while (k) {
            if (k & 1)
                res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    static modint add_identity() { return modint(0); }
    static modint mul_identity() { return modint(1); }
    constexpr modint inv() { return pow(mod - 2); }

    constexpr modint &operator+=(const modint a) noexcept {
        v += a.v;
        if (v >= mod)
            v -= mod;
        return *this;
    }
    constexpr modint &operator-=(const modint a) noexcept {
        v += mod - a.v;
        if (v >= mod)
            v -= mod;
        return *this;
    }
    constexpr modint &operator*=(const modint a) noexcept {
        v = v * a.v % mod;
        return *this;
    }
    constexpr modint &operator/=(const modint a) noexcept { return (*this) *= a.inv(); }

    constexpr modint operator+(const modint a) const noexcept { return modint(v) += a; };
    constexpr modint operator-(const modint a) const noexcept { return modint(v) -= a; };
    constexpr modint operator*(const modint a) const noexcept { return modint(v) *= a; };
    constexpr modint operator/(const modint a) const noexcept { return modint(v) /= a; };
    constexpr modint operator-() const noexcept { return v ? modint(mod - v) : modint(v); }

    constexpr bool operator==(const modint a) const noexcept { return v == a.v; }
    constexpr bool operator!=(const modint a) const noexcept { return v != a.v; }
    constexpr bool operator<(const modint a) const noexcept { return v < a.v; }
};
using mint = modint<mod>;
ostream &operator<<(ostream &os, mint m) { return os << m.v; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    lint k;
    cin >> k;
    vector<int> ones;
    int one = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '0') {
            ones.push_back(one);
            one = 0;
        } else {
            one++;
        }
    }
    ones.push_back(one);
    int m = ones.size();
    vector<vector<vector<mint>>> dp(m + 1, vector<vector<mint>>(n + 1, vector<mint>(n + 1, 0)));
    dp[0][0][0] = 1;
    for (int i = 1; i <= m - 1; ++i) {
        vector<vector<mint>> temp(400, vector<mint>(400, 0));
        for (int j = 0; j <= n; ++j) {
            for (int l = 0; l <= n; ++l) {
                temp[j][l]  = dp[i - 1][j][l];
                dp[i][j][l] = dp[i - 1][j][l];
            }
        }
        for (int j = 0; j <= n; ++j) {
            for (int l = 0; l <= n; ++l) {
                for (int x = 1; x <= ones[i - 1]; ++x) { // total  < 300
                    if (k - x < 0 || l - x < 0)
                        break;
                    temp[j][l - x] += temp[j][l];
                }
            }
        }
        for (int j = 0; j <= n; ++j) {
            for (int l = 0; l <= n; ++l) {
                temp[j][l] -= dp[i - 1][j][l];
            }
        }

        for (int j = 1; j <= n; ++j) {
            for (int l = 1; l <= n; ++l) {
                if (j + l >= n)
                    break;
                dp[i][j + l - 1][l] += dp[i][j + l - 2][l - 1];
            }
        }
        for (int j = 2; j <= n; ++j) {
            for (int l = 1; l <= n; ++l) {
                if (j + l >= n)
                    break;
                dp[i][l][j + l - 1] += dp[i][l - 1][j + l - 2];
            }
        }

        for (int j = 0; j <= n; ++j) {
            for (int l = 0; l <= n; ++l) {
                dp[i][j][l] += temp[j][l];
            }
        }
    }
    int id   = min(k, lint(n));
    mint ret = 0;
    for (int i = 0; i <= id; ++i) {
        for (int j = 0; j <= ones[m - 1]; ++j) {
            ret += dp[m - 1][i][j];
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 219556