def main():

    mod = 998244353

    s, k = input().split()

    k = int(k)

    n = len(s)



    one = s.count("1")



    cnt = 0

    zero_list = []

    for i in range(n):

        if s[i] == "0":

            zero_list.append(cnt)

            cnt = 0

        else:

            cnt += 1



    z = 0

    mm = min(one, k)



    dp = [[0]*(one+1) for _ in [0]*(one+1)]

    dp[0][0] = 1



    for i in range(len(zero_list)):

        dp2 = [[0]*(mm+1) for _ in [0]*(one+1)]

        base = zero_list[i]

        # j:何個今までに入れたか

        for j in range(one+1):

            # l:何個入れるか

            for l in range(one+1-j):

                if l < z+base-j:

                    continue

                ml = max(l-base, 0)

                # p:これまでのペナルティ

                for p in range(min(one, k)+1):

                    q = p+ml

                    if q <= mm:

                        dp2[j+l][q] = (dp2[j+l][q]+dp[j][p]) % mod

                    else:

                        break

        z += base

        dp = dp2

    print((sum([sum(i) for i in dp]) % mod))





main()
def main():

    mod = 998244353

    s, k = input().split()

    k, n, one, cnt, z, zero_list = int(k), len(s), s.count("1")+1, 0, 0, []

    for i in range(n):

        if s[i] == "0":

            zero_list.append(cnt)

            cnt = 0

        else:

            cnt += 1

    mm = min(one-1, k)



    dp = [[0]*(mm+1) for _ in [0]*one]

    dp[0][0] = 1



    for i in zero_list:

        dp2 = [[0]*(mm+1) for _ in [0]*one]

        for j in range(one):

            for l in range(max(z+i-j, 0), one-j):

                ml = max(l-i, 0)

                for p in range(min(j, mm-ml)+1):

                    dp2[j+l][p+ml] = (dp2[j+l][p+ml]+dp[j][p]) % mod

        z += i

        dp = dp2

    print((sum([sum(i) for i in dp]) % mod))





main()
def main():
    mod = 998244353
    s, k = input().split()
    k = int(k)
    n = len(s)
    one = s.count("1")
    cnt = 0
    zero_list = []
    for i in range(n):
        if s[i] == "0":
            zero_list.append(cnt)
            cnt = 0
        else:
            cnt += 1
    z = 0
    mm = min(one, k)
    dp = [[0] * (one + 1) for _ in [0] * (one + 1)]
    dp[0][0] = 1
    for i in range(len(zero_list)):
        dp2 = [[0] * (mm + 1) for _ in [0] * (one + 1)]
        base = zero_list[i]
        # j:何個今までに入れたか
        for j in range(one + 1):
            # l:何個入れるか
            for l in range(one + 1 - j):
                if l < z + base - j:
                    continue
                ml = max(l - base, 0)
                # p:これまでのペナルティ
                for p in range(min(one, k) + 1):
                    q = p + ml
                    if q <= mm:
                        dp2[j + l][q] = (dp2[j + l][q] + dp[j][p]) % mod
                    else:
                        break
        z += base
        dp = dp2
    print((sum([sum(i) for i in dp]) % mod))


main()

def main():
    mod = 998244353
    s, k = input().split()
    k, n, one, cnt, z, zero_list = int(k), len(s), s.count("1") + 1, 0, 0, []
    for i in range(n):
        if s[i] == "0":
            zero_list.append(cnt)
            cnt = 0
        else:
            cnt += 1
    mm = min(one - 1, k)
    dp = [[0] * (mm + 1) for _ in [0] * one]
    dp[0][0] = 1
    for i in zero_list:
        dp2 = [[0] * (mm + 1) for _ in [0] * one]
        for j in range(one):
            for l in range(max(z + i - j, 0), one - j):
                ml = max(l - i, 0)
                for p in range(min(j, mm - ml) + 1):
                    dp2[j + l][p + ml] = (dp2[j + l][p + ml] + dp[j][p]) % mod
        z += i
        dp = dp2
    print((sum([sum(i) for i in dp]) % mod))


main()

-    k = int(k) -    n = len(s) -    one = s.count("1") -    cnt = 0 -    zero_list = [] +    k, n, one, cnt, z, zero_list = int(k), len(s), s.count("1") + 1, 0, 0, [] -    z = 0 -    mm = min(one, k) -    dp = [[0] * (one + 1) for _ in [0] * (one + 1)] +    mm = min(one - 1, k) +    dp = [[0] * (mm + 1) for _ in [0] * one] -    for i in range(len(zero_list)): -        dp2 = [[0] * (mm + 1) for _ in [0] * (one + 1)] -        base = zero_list[i] -        # j:何個今までに入れたか -        for j in range(one + 1): -            # l:何個入れるか -            for l in range(one + 1 - j): -                if l < z + base - j: -                    continue -                ml = max(l - base, 0) -                # p:これまでのペナルティ -                for p in range(min(one, k) + 1): -                    q = p + ml -                    if q <= mm: -                        dp2[j + l][q] = (dp2[j + l][q] + dp[j][p]) % mod -                    else: -                        break -        z += base +    for i in zero_list: +        dp2 = [[0] * (mm + 1) for _ in [0] * one] +        for j in range(one): +            for l in range(max(z + i - j, 0), one - j): +                ml = max(l - i, 0) +                for p in range(min(j, mm - ml) + 1): +                    dp2[j + l][p + ml] = (dp2[j + l][p + ml] + dp[j][p]) % mod +        z += i