#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int mod=998244353;
int Pow(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(LL)x*x%mod)
		if (y&1)
			ans=(LL)ans*x%mod;
	return ans;
}
void Add(int &x,int y){
	if ((x+=y)>=mod)
		x-=mod;
}
void Del(int &x,int y){
	if ((x-=y)<0)
		x+=mod;
}
int Add(int x){
	return x>=mod?x-mod:x;
}
int Del(int x){
	return x<0?x+mod:x;
}
void ckmax(int &x,int y){
	if (x<y)
		x=y;
}
void ckmin(int &x,int y){
	if (x>y)
		x=y;
}
const int N=305;
int n,k;
char s[N];
int dp[N][N][N];
int a[N],b[N];
int c0=0,c1=0;
int main(){
	cin>>(s+1);
	n=strlen(s+1);
	k=read();
//	n=300;
//	For(i,1,n)
//		s[i]=rand()%2?'1':'0';
//	k=300;
	For(i,1,n)
		if (s[i]=='1')
			c0++;
		else
			a[++c1]=c0,b[c1]=a[c1]-a[c1-1];
	k=min(k,c0);
	dp[0][0][0]=1;
//	outval(c0),outval(c1);
//	outarr(a,0,c1);
	For(i,1,c1)
		For(j,0,c0)
			For(t,0,k){
//				outval(i);
				int v=dp[i-1][j][t];
				if (!v||j<a[i-1])
					continue;
//				printf("dp[%d][%d][%d] = %d\n",i-1,j,t,v);
				int ub=min(c0-j,k-t+b[i]);
				For(now,0,ub){
					if (now<=b[i])
						Add(dp[i][j+now][t],v);
					else
						Add(dp[i][j+now][t+now-b[i]],v);
				}
			}
	int ans=0;
	For(j,a[c1],c0)
		For(t,0,k){
//			if (dp[c1][j][t])
//				printf("dp[%d][%d][%d] = %d\n",c1,j,t,dp[c1][j][t]);
			Add(ans,dp[c1][j][t]);
		}
	cout<<ans<<endl;
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int mod = 998244353;
inline int add(int u, int v) {
  return u + v >= mod ? u + v - mod : u + v;
}
inline int sub(int u, int v) {
  return u >= v ? u - v : u - v + mod;
}
inline int mul(ll u, int v) {
  return u * v % mod;
}

const int N = 303, M = 1000;
int choose[M][M];

inline int partition(int n, int k) {
  return choose[n + k - 1][k - 1];
}

int ways[N][N][N]; // ways[i][j][f] = last i, j moves, f free ones

int solve(VI& ones, int k) {
  const int n = ones.size();
  if (n == 0) return 1;

  ways[n][0][0] = 1;
  for (int i = n; i >= 1; i--) {
    const int len = ones[i - 1];
    for (int j = 0; j <= k; j++) {
      for (int f = 0; f < N; f++) {
        ways[i - 1][j][f] = ways[i][j][f];
      }
    }
    for (int j = 0; j <= k; j++) {
      for (int f = N - 2; f >= 0; f--) {
        ways[i - 1][j][f] = add(ways[i - 1][j][f], ways[i - 1][j][f + 1]);
      }
    }
    for (int j = 0; j <= k; j++) {
      for (int cur = 1; cur <= len && j + cur <= k; cur++) {
        for (int f = 0; f + cur < N; f++) {
          ways[i - 1][j + cur][f + cur] = add(ways[i - 1][j + cur][f + cur], ways[i][j][f]);
        }
      }
    }
  }

  int ans = 0;
  for (int j = 0; j <= k; j++) {
    for (int f = 0; f < N; f++) {
      ans = add(ans, ways[0][j][f]);
    }
  }

  return ans;
}

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  string s; cin >> s;
  int k; cin >> k;
  vector<int> ones;
  int f = 0;
  bool seen = false;
  for (char c: s) {
    if (c == '1') {
      f++;
    }
    if (c == '0') {
      if (seen) {
        ones.push_back(f);
      }
      f = 0;
      seen = true;
    }
  }
  if (f > 0 && seen) {
    ones.push_back(f);
  }

  for (int n = 0; n < M; n++) {
    choose[n][0] = choose[n][n] = 1;
    for (int r = 1; r < n; r++) {
      choose[n][r] = add(choose[n - 1][r], choose[n - 1][r - 1]);
    }
  }

  k = min(k, 300);
  cout << solve(ones, k) << endl;

  return 0;
}
