description: You are given a binary string (i. e. a string consisting of characters 0 and/or 1) s of length n. You can perform the following operation with the string s at most once: choose a substring (a contiguous subsequence) of s having exactly k characters 1 in it, and shuffle it (reorder the characters in the substring as you wish).
  
  Calculate the number of different strings which can be obtained from s by performing this operation at most once.
  
  Input
  
  The first line contains two integers n and k (2 ≤ n ≤ 5000; 0 ≤ k ≤ n).
  
  The second line contains the string s of length n, consisting of characters 0 and/or 1.
  
  Output
  
  Print one integer — the number of different strings which can be obtained from s by performing the described operation at most once. Since the answer can be large, output it modulo 998244353.
  
  Examples
  
  Input
  
  
  7 2
  1100110
  
  
  Output
  
  
  16
  
  
  Input
  
  
  5 0
  10010
  
  
  Output
  
  
  1
  
  
  Input
  
  
  8 1
  10001000
  
  
  Output
  
  
  10
  
  
  Input
  
  
  10 8
  0010011000
  
  
  Output
  
  
  1
  
  Note
  
  Some strings you can obtain in the first example:
  
    * to obtain 0110110, you can take the substring from the 1-st character to the 4-th character, which is 1100, and reorder its characters to get 0110; 
    * to obtain 1111000, you can take the substring from the 3-rd character to the 7-th character, which is 00110, and reorder its characters to get 11000; 
    * to obtain 1100101, you can take the substring from the 5-th character to the 7-th character, which is 110, and reorder its characters to get 101. 
  
  
  
  In the second example, k = 0 so you can only choose the substrings consisting only of 0 characters. Reordering them doesn't change the string at all, so the only string you can obtain is 10010.
solution: import java.io.*;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.StringTokenizer;
  import java.util.List;
   import java.util.*;
    public class realfast implements Runnable 
    {
      private static final int INF = (int) 1e9;
      long in= 1000000007;
      long fac[]= new long[1000001];
      long inv[]=new long[1000001];
      public  void solve() throws IOException 
      {
  
          //int t = readInt();
          long in = 998244353;
  
          long fac[]=new long [5001];
          long inv[]=new long[5001];
          fac[0]=1;
          inv[0]=1;
          for(int i=1;i<=5000;i++){
              fac[i] =  (i*fac[i-1])%in;
              inv[i]= pow(fac[i],in-2,in);
          }
  
  
          int n = readInt();
          int k = readInt();
          String s= readString();
  
          int one[]=new int[n+1];
          int zero[]=new int[n+1];
  
          for(int i =0;i<n;i++)
          {
              one[i+1]=one[i];
              if(s.charAt(i)=='1')
                  one[i+1]++;
          }
  
          for(int i =0;i<n;i++)
          {
              zero[i+1]=zero[i];
              if(s.charAt(i)=='0')
                  zero[i+1]++;
          }
  
          long ans =0;
  
          for(int i=1;i<=n;i++)
          {
              for(int j=i+1;j<=n;j++)
              {
                  if(one[j]-one[i-1]<=k&&one[n]>=k)
                  {
                    int e = zero[j]-zero[i-1];
                    int o = one[j]- one[i-1];
  
                    if(s.charAt(i-1)=='0')
                      o--;
                    else
                      e--;
  
                    if(s.charAt(j-1)=='1')
                      e--;
                    else
                      o--;
  
                    ans = (ans%in + ncr(fac,o,e,inv,in)%in)%in;
  
                  }
              }
  
          }
  
          out.println((ans+1)%in);
  
  
  
  
  
          
          
        
  
      }
  
      public long ncr(long fac[] , int even, int odd, long inv[], long in)
      {
          if(even<0)
              return 0;
          if(odd<0)
              return 0;
  
          long pal = fac[even+odd];
          pal = (pal*inv[even])%in;
          pal = (pal*inv[odd])%in;
  
          return pal;
  
      }
      
      public int value (int seg[], int left , int right ,int index, int l, int r)
      {
              
              if(left>right)
              {
                return -100000000;
              }
              if(right<l||left>r)
                  return -100000000;
              if(left>=l&&right<=r)
                  return seg[index];
              int mid = left+(right-left)/2;
              int val = value(seg,left,mid,2*index+1,l,r);
              int val2 = value(seg,mid+1,right,2*index+2,l,r);
              return Math.max(val,val2);
  
      }
     
      public int gcd(int a , int b )
      {
        if(a<b)
        {
          int t =a;
          a=b;
          b=t;
        }
        if(a%b==0)
          return b ;
        return gcd(b,a%b);
      }
      public long pow(long n , long p,long m)
      {
           if(p==0)
              return 1;
          long val = pow(n,p/2,m);;
          val= (val*val)%m;
          if(p%2==0)
              return val;
          else
              return (val*n)%m;
      }
      
      
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      public static void main(String[] args) {
          new Thread(null, new realfast(), "", 128 * (1L << 20)).start();
      }
   
      private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
      private BufferedReader reader;
      private StringTokenizer tokenizer;
      private PrintWriter out;
   
      @Override
      public void run() {
          try {
              if (ONLINE_JUDGE || !new File("input.txt").exists()) {
                  reader = new BufferedReader(new InputStreamReader(System.in));
                  out = new PrintWriter(System.out);
              } else {
                  reader = new BufferedReader(new FileReader("input.txt"));
                  out = new PrintWriter("output.txt");
              }
              solve();
          } catch (IOException e) {
              throw new RuntimeException(e);
          } finally {
              try {
                  reader.close();
              } catch (IOException e) {
                  // nothing
              }
              out.close();
          }
      }
   
      private String readString() throws IOException {
          while (tokenizer == null || !tokenizer.hasMoreTokens()) {
              tokenizer = new StringTokenizer(reader.readLine());
          }
          return tokenizer.nextToken();
      }
   
      @SuppressWarnings("unused")
      private int readInt() throws IOException {
          return Integer.parseInt(readString());
      }
   
      @SuppressWarnings("unused")
      private long readLong() throws IOException {
          return Long.parseLong(readString());
      }
   
      @SuppressWarnings("unused")
      private double readDouble() throws IOException {
          return Double.parseDouble(readString());
      }
  }
  class edge implements Comparable<edge>{
      int u ;
      int v;
      
      edge(int u, int v)
      {
         this.u=u;
         this.v=v;
      }
      public int compareTo(edge e)
      {
          return this.v-e.v;
      }
  }