#pragma comment(linker, "/STACK:512000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
#ifdef AIM
#include <sys/resource.h>
#endif
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
  string s = FILENAME;
//    assert(!s.empty());
  freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/cryptozoology/output.txt", "w", stdout);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
  cout.sync_with_stdio(0);
  cin.tie(0);
#endif

#ifdef AIM
  const rlim_t kStackSize = 256 * 1024 * 1024;
  struct rlimit rl;
  int result;

  result = getrlimit(RLIMIT_STACK, &rl);
  if (result == 0)
  {
    if (rl.rlim_cur < kStackSize)
    {
      rl.rlim_cur = kStackSize;
      result = setrlimit(RLIMIT_STACK, &rl);
      if (result != 0)
      {
        fprintf(stderr, "setrlimit returned result = %d\n", result);
      }
    }
  }
#endif

  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
      //cout << "Case #" << testNum++ << ": ";
      solve(true);
  }
  cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cout.flush();
  auto end = clock();

  usleep(10000);
  print_stats(end - start);
  usleep(10000);
#endif

    return 0;
}

template<typename T>
T binpow(T q, T w, T mod) {
    if (!w)
        return 1 % mod;
    if (w & 1)
        return q * 1LL * binpow(q, w - 1, mod) % mod;
    return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
    while (w) {
        q %= w;
        swap(q, w);
    }
    return q;
}
template<typename T>
T lcm(T q, T w) {
    return q / gcd(q, w) * w;
}

template <typename T>
void make_unique(vector<T>& a) {
    sort(all(a));
    a.erase(unique(all(a)), a.end());
}

template<typename T>
void relax_min(T& cur, T val) {
    cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
    cur = max(cur, val);
}

void precalc() {
}

#define int li
const int mod = 998244353;

void add(int& cur, int val) {
  cur += val;
  cur %= mod;
}

void solve(__attribute__((unused)) bool read) {
  string s;
  int k;
  cin >> s >> k;
  int n = (int)s.length();
  if (k > n) {
    k = n;
  }
  vector<int> nums;
  nums.push_back(0);
  while (!s.empty()) {
    while (!s.empty() && s.back() == '1') {
      s.pop_back();
      ++nums.back();
    }
    while (!s.empty() && s.back() == '0') {
      nums.push_back(0);
      s.pop_back();
    }
  }
  vector<vector<vector<int>>> dp(2, vector<vector<int>>(k + 1, vector<int>(k + 1, 0)));
  int par = 0;
  dp[par][0][0] = 1;
  for (int num : nums) {
    dp[par ^ 1].assign(k + 1, vector<int>(k + 1, 0));
    for (int spent = 0; spent <= k; ++spent) {
      for (int in_air = 0; in_air <= k; ++in_air) {
        int cur_dp = dp[par][spent][in_air];
        if (cur_dp == 0) {
          continue;
        }
        for (int new_num = 0; new_num <= num + in_air; ++new_num) {
          if (new_num >= num) {
            add(dp[par ^ 1][spent][in_air - (new_num - num)], cur_dp);
          } else {
            int new_spent = spent + (num - new_num);
            int new_air = in_air + (num - new_num);
            if (new_spent <= k) {
              add(dp[par ^ 1][new_spent][new_air], cur_dp);
            }
          }
        }
      }
    }
    par ^= 1;
  }

  int res = 0;
  for (int spent = 0; spent <= k; ++spent) {
    add(res, dp[par][spent][0]);
  }
  cout << res << "\n";

}

Measured memory_bytes: 5344