#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;
template<int64_t M = 1000000007>
class ModInt {
public:
	ModInt() : val_(0) {};

	ModInt(int64_t val) {
		this->val_ = val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0)  this->val_ += M;
	}

	operator int64_t() const {
		return this->val_;
	}

	ModInt& operator += (int64_t val) {
		this->val_ += val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator -= (int64_t val) {
		this->val_ -= val;
		this->val_ %= M;
		while (this->val_ >= M) this->val_ -= M;
		while (this->val_ < 0) this->val_ += M;

		return *this;
	}

	ModInt& operator *= (int64_t val) {
		this->val_ *= val;
		this->val_ %= M;

		return *this;
	}

	ModInt& operator /= (int64_t val) {
		ModInt v = ModInt::pow(val, M - 2);
		*this *= v;

		return *this;
	}

	ModInt operator + (int64_t v) const {
		ModInt ret = *this;
		return (ret += v);
	}

	ModInt operator - (int64_t v) const {
		ModInt ret = *this;
		return (ret -= v);
	}

	ModInt operator * (int64_t v) const {
		ModInt ret = *this;
		return (ret *= v);
	}

	ModInt operator / (int64_t v) const {
		ModInt ret = *this;
		return (ret /= v);
	}

	static ModInt pow(ModInt n, int64_t m) {
		if (m == 0) {
			ModInt ret(1);
			return ret;
		}
		if (m == 1) {
			return n;
		}

		ModInt v = pow(n, m / 2);
		ModInt ret = v * v;
		if (m & 1) {
			ret *= n;
		}
		return ret;
	}

	ostream& operator << (ostream& out) {
		out << this->val_;
		return out;
	}

private:
	int64_t val_;
};
static const int64_t kRem = 998244353;

ModInt<kRem> dp[301][301];

static unordered_map<int64_t, ModInt<kRem>> memo;

ModInt<kRem> solve(vector<int>& os, int i, int ck, int uk, int k)
{

	//cout << i << " " << ck << " " << uk << endl;
	if (ck < 0) {
		return 0;
	}
	if (k < uk) {
		return 0;
	}

	if (i == 0) {
		return 1;
	}

	int64_t idx = i * (301 * 301) + ck * 301 + uk;
	auto it = memo.find(idx);
	if (it != memo.end()) {
		return it->second;
	}

	ModInt<kRem> ans = 0;
	FOR_LE(n, 0, os[i] + ck) {
		if (n <= os[i]) {
			ans += solve(os, i - 1, ck + os[i] - n, uk + os[i] - n, k);
		}
		else {
			ans += solve(os, i - 1, ck + os[i] - n, uk, k);
		}
	}

	//cout << i << " " << ck << " " << uk << " " << ans << endl;

	memo.insert({ idx, ans });
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	string s; cin >> s;
	int k; cin >> k;

	vector<int> os;
	{
		int co = 0;
		FOR_LT(i, 0, s.size()) {
			if (s[i] == '1') {
				co++;
			}
			else {
				os.push_back(co);
				co = 0;
			}
		}
		os.push_back(co);
	}
	int m = 0; for (int o : os) { m += o; }
	k = min(m, k);

	cout << solve(os, os.size() - 1, 0, 0, k) << endl;

	return 0;
}

Measured memory_bytes: 32504