Problem: You are given string s of length n consisting of 0-s and 1-s. You build an infinite string t as a concatenation of an infinite number of strings s, or t = ssss ... For example, if s = 10010, then t = 100101001010010...

Calculate the number of prefixes of t with balance equal to x. The balance of some string q is equal to cnt_{0, q} - cnt_{1, q}, where cnt_{0, q} is the number of occurrences of 0 in q, and cnt_{1, q} is the number of occurrences of 1 in q. The number of such prefixes can be infinite; if it is so, you must say that.

A prefix is a string consisting of several first letters of a given string, without any reorders. An empty prefix is also a valid prefix. For example, the string "abcd" has 5 prefixes: empty string, "a", "ab", "abc" and "abcd".

Input

The first line contains the single integer T (1 ≤ T ≤ 100) — the number of test cases.

Next 2T lines contain descriptions of test cases — two lines per test case. The first line contains two integers n and x (1 ≤ n ≤ 10^5, -10^9 ≤ x ≤ 10^9) — the length of string s and the desired balance, respectively.

The second line contains the binary string s (|s| = n, s_i ∈ \{0, 1\}).

It's guaranteed that the total sum of n doesn't exceed 10^5.

Output

Print T integers — one per test case. For each test case print the number of prefixes or -1 if there is an infinite number of such prefixes.

Example

Input


4
6 10
010010
5 3
10101
1 0
0
2 0
01


Output


3
0
1
-1

Note

In the first test case, there are 3 good prefixes of t: with length 28, 30 and 32.

Solution (in JAVA):

Solution:
import java.util.*;
import java.io.*;
public class Chef
{
    static class Pair{
        int parent;
        int rank;
        Pair(int parent,int rank)
        {
            this.rank=rank;
            this.parent=parent;
        }
    }
    static int find(Pair pr[],int i)
    {
        if(i==pr[i].parent)
            return i;
        else
        {
            pr[i].parent=find(pr,pr[i].parent);
            return pr[i].parent;
        }
    }
    static void join(Pair[] pr,int i,int j)
    {
        i=find(pr,i);
        j=find(pr,j);
        if(i==j)
            return;
        if(pr[i].rank>=pr[j].rank)
        {
            pr[j].parent=i;
            pr[i].rank+=pr[j].rank;
        }
        else
        {
            pr[i].parent = j;
            pr[j].rank+=pr[i].rank;
        }
    }
    static void swap(char ar[],int i,int j)
    {
        char f = ar[i];
        ar[i]=ar[j];
        ar[j]=f;
    }
    static HashSet<Integer> graph[];
    public static void main (String[] args) throws IOException
    {
        StringBuilder sb = new StringBuilder();
        FastReader s1 = new FastReader();
        int t=s1.I();
        while(t--!=0)
        {
            int n=s1.I();
            long T=s1.L();
            String s = s1.next();
            int ar[]=new int[n];
            long one=0;
            long zero=0;
            for(int i=0;i<n;i++)
            {
                if(s.charAt(i)=='1')
                    one++;
                else
                    zero++;
                ar[i]=(int)(zero-one);
            }
            long d=zero-one;
            if(d!=0)
            {
                int count=0;
                for(int i=0;i<n;i++)
                {
                    if(isComp(ar[i],d,T))
                    {
                        count++;
                    }
                }
                if(T==0)
                    count++;
                sb.append(count+"\n");
            }
            else
            {
                boolean flag=false;
                for(int i=0;i<n;i++)
                {
                    if(ar[i]==T)
                    {
                        flag=true;
                        break;
                    }
                }
                if(flag)
                    sb.append("-1\n");
                else
                    sb.append("0\n");
            }
        }
        System.out.println(sb);
    }
    static boolean isComp(int a,long d,long t)
    {
        long demo=t-a;
        if(demo%d==0)
        {
            long n=(demo/d)+1;
            if(n>0)
            {
                return true;
            }
            else
                return false;
        }
        else
            return false;
    }
    static double slope(int x1,int y1,int x2,int y2)
    {
        int x = x1-x2;
        int y = y1-y2;
        if(x==0 || y==0)
        {
            return 0;
        }
        else
        {
            return ((double)y)/x;
        }
    }
    static int longestSubSeg(int a[], int n,int k)
    {
        int cnt0 = 0;
        int l = 0;
        int max_len = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] == 0)
                cnt0++;
            while (cnt0 > k){
                if (a[l] == 0)
                    cnt0--;
                l++;
            }
            max_len = Math.max(max_len, i - l + 1);
        }
        
        return max_len;
    }
//    static void dfs(int index,boolean ar[])
//    {
//        ar[index]=true;
//        for(int i=0;i<graph[index].size();i++)
//        {
//            if(!ar[graph[index].get(i)])
//            {
//                dfs(graph[index].get(i),ar);
//            }
//        }
//    }
    static int binary(int left,int right,int ar[],int no)
    {
        int mid=(left+right)/2;
        if(Math.abs(right-left)<=1)
        {
            if(no>=ar[right])
            {
                return right+1;
            }
            else if(no<ar[left])
            {
                return left;
            }
            else
            {
                return left+1;
            }
        }
        if(ar[mid]>no)
        {
            right=mid-1;
            return binary(left, right, ar, no);
        }
        else{
            left=mid;
            return binary(left, right, ar, no);
        }
    }
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader()
        {
            br = new BufferedReader(new
                             InputStreamReader(System.in));
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int I()
        {
            return Integer.parseInt(next());
        }
        
        long L()
        {
            return Long.parseLong(next());
        }
        
        double D()
        {
            return Double.parseDouble(next());
        }
        
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static int gcd(int a,int b)
    {
        if(a%b==0)
            return b;
        return gcd(b,a%b);
    }
    static float power(float x, int y)
    {
        float temp;
        if( y == 0)
            return 1;
        temp = power(x, y/2);
        
        if (y%2 == 0)
            return temp*temp;
        else
        {
            if(y > 0)
                return x * temp * temp;
            else
                return (temp * temp) / x;
        }
    }
    static long pow(long x, long y)
    {
        int p = 1000000007;
        long res = 1;
        x = x % p;
        while (y > 0)
        {
            if((y & 1)==1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }
    static ArrayList<Integer> sieveOfEratosthenes(int n)
    {
        ArrayList<Integer> arr=new ArrayList<Integer>();
        boolean prime[] = new boolean[n+1];
        for(int i=2;i<n;i++)
            prime[i] = true;
        
        for(int p = 2; p*p <=n; p++)
        {
            if(prime[p] == true)
            {
                arr.add(p);
                for(int i = p*p; i <= n; i += p)
                    prime[i] = false;
            }
        }
        return arr;
    }
}