#include <bits/stdc++.h>

using namespace std;
const int Mod = 998244353;
int main() {
    string s;
    int K;
    cin >> s >> K;
    vector<int> groups(1);
    int n_ones = 0;
    for (char c: s) {
        if (c == '1') {
            ++groups.back();
            ++n_ones;
        }
        else {
            groups.push_back(0);
        }
    }
    vector<vector<vector<int>>> dp(groups.size() + 1,
                vector<vector<int>>(n_ones + 1, vector<int>(n_ones + 1)));
    dp[0][0][0] = 1;
    int sum = 0;
    for (int k = 1; k <= (int) groups.size(); ++k) {
        sum += groups[k - 1];
        for (int g = 0; g <= n_ones; ++g) {
            for (int si = sum; si <= n_ones; ++si) {
                for (int sp = 0; sp <= n_ones; ++sp) {
                    int psi = si - g;
                    int psp = sp - max(g - groups[k - 1], 0);
                    if (psi < 0 || psp < 0)
                        continue;
                    dp[k][si][sp] = (dp[k][si][sp] + dp[k - 1][psi][psp]) % Mod;
                }
            }
        }
    }
    int res = 0;
    for (int i = 0; i <= n_ones; ++i) {
        for (int k = 0; k <= min(K, n_ones); ++k)
            res = (res + dp.back()[i][k]) % Mod;
    }
    cout << res << "\n";
    return 0;
}
