/*
Loading:{
        https://codeforces.com/problemset/problem/1234/F
}
*/
#include <bits/stdc++.h>

using namespace std;

#define ll int // optimize with int
#define endl '\n'
const int N = 1e6 + 5;
ll a[305];
ll dp[305][305][305]; // id, used to donate, used to receive;
ll mod = 998244353; // fucking mod 1e9 + 7
ll n, k, cnt = 0;
ll add(ll x, ll y){ // optimize with add func
        ll res = x + y;
        if (res >= mod) res -= mod;
        return res;
}
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("GUARDS.INP", "r")){
                freopen("GUARDS.INP", "r", stdin);
                freopen("GUARDS.OUT", "w", stdout);
        }
        string s;
        cin >> s;
        n = s.length();
        cin >> k;
        ll cur = 0;
        ll cnt1 = 0;
        for (int i = s.length() - 1; i >= 0; i--){
                if (s[i] == '1') {
                        cur++;
                        cnt1++;
                }
                else {
                        cnt++;
                        a[cnt] = cur;
                        cur = 0;
                }
        }
        cnt++;
        a[cnt] = cur;
        //memset(dp, -1, sizeof(dp));
        k = min(k, cnt1);
        for (int i = a[1]; i >= max(0, a[1] - k); i--){
                dp[1][a[1] - i][0] = 1;
        }
        ll sum = a[1];
        for (int i = 1; i < cnt; i++){
                for (int j = 0; j <= sum; j++){
                        for (int t = 0; t <= j; t++){
                                dp[i + 1][j][t] = add(dp[i + 1][j][t], dp[i][j][t]);
                                for (int x = a[i + 1] - 1; x >= max(0, (a[i + 1] - (k - j))); x--){
                                        dp[i + 1][j + a[i + 1] - x][t] = add(dp[i + 1][j + a[i + 1] - x][t], dp[i][j][t]);
                                }
                                for (int x = a[i + 1] + 1; x <= a[i + 1] + (j - t); x++){
                                        dp[i + 1][j][t + x - a[i + 1]] = add(dp[i + 1][j][t + x - a[i + 1]], dp[i][j][t]);
                                }
                        }
                }
                sum += a[i + 1];
        }
        ll ans = 0;
        for (int i = 0; i <= k; i++) {
                ans = add(ans, dp[cnt][i][i]);
                //cout << dp[cnt][i][i] << " ";
        }
        cout << ans;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
constexpr ll mod = 998244353;
ll dp[301][301][301] = {},dp2[301][301] = {},dp3[301][301] = {};
vector<int> v;
int main(){
    int i,j,k,l,r;
    string s; cin >> s >> k;
    s.push_back('0');
    int n = s.size();
    for(i=0;i<n;i++){
        if(s[i]=='0'){
            int cnt = 0;
            if(i==0) v.push_back(0);
            for(j=i - 1;j>=0;j--){
                if(j!=0 && s[j]=='1'){
                    cnt++;
                }else{
                    v.push_back(cnt);
                    break;
                }
            }
        }
    }
    int m = v.size(),sum = 300;
    dp[m][0][0] = 1;
    for(i=m - 1;i>=0;i--){
        for(l=0;l<=sum;l++){
            dp2[sum][l] = dp[i + 1][sum][l];
            for(j=sum - 1;j>=0;j--){
                dp2[j][l] = dp2[j + 1][l];
                (dp2[j][l] += dp[i + 1][j][l]);
            }
        }
        for(j=0;j<=sum;j++){
            for(l=0;l<=sum;l++){
                (dp[i][j][l] += dp2[j][l]) %= mod;
                for(r=1;r<=min({j,l,v[i]});r++){
                    (dp[i][j][l] += dp[i + 1][j - r][l - r]) %= mod;
                }
            }
        }
    }
    ll ans = 0;
    for(i=0;i<=min(300,k);i++){
        (ans += dp[0][0][i]) %= mod;
    }
    cout << ans << endl;
}