#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>

template <uint32_t Modulus>
class modular {
public:
  using value_type = uint32_t;
  using max_type = uint64_t;

  static constexpr value_type mod = Modulus;
  static constexpr value_type get_mod() { return mod; }
  static_assert(mod >= 2, "invalid mod :: smaller than 2");
  static_assert(mod < (value_type(1) << 31), "invalid mod :: over 2^31");

  template <class T>
  static constexpr value_type normalize(T value_) {
    if (value_ < 0) {
      value_ = -value_;
      value_ %= mod;
      if (value_ == 0) return 0;
      return mod - value_;
    }
    return value_ % mod;
  }

private:
  value_type value;

public:
  constexpr modular(): value(0) { }
  template <class T>
  explicit constexpr modular(T value_): value(normalize(value_)) { }
  template <class T>
  explicit constexpr operator T() { return static_cast<T>(value); }

  constexpr value_type get() const { return value; }
  constexpr modular operator - () const { return modular(mod - value); }
  constexpr modular operator ~ () const { return inverse(); }

  constexpr value_type &extract() { return value; }
  constexpr modular inverse() const { return power(mod - 2); }
  constexpr modular power(max_type exp) const {
    modular res(1), mult(*this);
    while (exp > 0) {
      if (exp & 1) res *= mult;
      mult *= mult;
      exp >>= 1;
    }
    return res;
  }

  constexpr modular operator + (const modular &rhs) const { return modular(*this) += rhs; }
  constexpr modular& operator += (const modular &rhs) { 
    if ((value += rhs.value) >= mod) value -= mod; 
    return *this; 
  }

  constexpr modular operator - (const modular &rhs) const { return modular(*this) -= rhs; }
  constexpr modular& operator -= (const modular &rhs) { 
    if ((value += mod - rhs.value) >= mod) value -= mod; 
    return *this; 
  }

  constexpr modular operator * (const modular &rhs) const { return modular(*this) *= rhs; }
  constexpr modular& operator *= (const modular &rhs) { 
    value = (max_type) value * rhs.value % mod;
    return *this;
  }

  constexpr modular operator / (const modular &rhs) const { return modular(*this) /= rhs; }
  constexpr modular& operator /= (const modular &rhs) { return (*this) *= rhs.inverse(); }

  constexpr bool zero() const { return value == 0; }
  constexpr bool operator == (const modular &rhs) const { return value == rhs.value; }
  constexpr bool operator != (const modular &rhs) const { return value != rhs.value; }
  friend std::ostream& operator << (std::ostream &stream, const modular &rhs) {
    return stream << rhs.value;
  }

};

using m32 = modular<998244353>;

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

int main() {
  std::string S;
  std::cin >> S;
  i32 K;
  std::cin >> K;
  S.push_back('0');
  std::reverse(S.begin(), S.end());
  std::vector<i32> one;
  for (auto c: S) {
    if (c == '1') one.back()++;
    else one.push_back(0);
  }
  i32 N = one.size();
  std::vector<i32> pref(N + 1);
  for (i32 i = 0; i < N; ++i) {
    pref[i + 1] = pref[i] + one[i];
  }
  i32 all = pref.back();
  K = std::min(K, all);
  std::vector<std::vector<m32>> dp(K + 1, std::vector<m32>(all + 1));
  dp[0][0] = (m32) 1;
  for (i32 i = 0; i < N; ++i) {
    std::vector<std::vector<m32>> next(K + 1, std::vector<m32>(all + 1));
    for (i32 j = 0; j <= std::min(K, pref[i]); ++j) {
      for (i32 l = 0; l <= pref[i]; ++l) {
        if (dp[j][l].zero()) continue;
        for (i32 k = 1; k <= one[i]; ++k) {
          if (j + k > K) break;
          next[j + k][l + k] += dp[j][l];
        }
        for (i32 k = one[i]; k <= pref[i + 1]; ++k) {
          if (k > l + one[i]) break;
          next[j][l + one[i] - k] += dp[j][l];
        }
      }
    }
    dp = std::move(next);
  }
  m32 ans;
  for (i32 i = 0; i <= K; ++i) {
    ans += dp[i][0];
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3972