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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long k) {
  if (k <= 1) {
    return false;
  }
  if (k == 2) {
    return true;
  }
  if (k % 2 == 0) {
    return false;
  }
  long long i = 3;
  while (i * i <= k) {
    if (k % i == 0) {
      return false;
    }
    i += 2;
  }
  return true;
}
long long modexp(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modexp(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = exgcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long modinv(long long x, long long mod) { return modexp(x, mod - 2, mod); }
const int Nx = 1e6 + 5;
long long fac[Nx];
void fact() {
  fac[0] = 1;
  for (int i = 1; i < Nx; i++) {
    fac[i] = (fac[i - 1] * i) % 998244353;
  }
  return;
}
long long nCr(long long a, long long b, long long mod) {
  return ((fac[a] * modinv(fac[b], mod)) % mod * modinv(fac[a - b], mod)) % mod;
}
long long N = 1e5 + 4;
vector<bool> is_prime(N + 1, true);
void validateprime(long long n) {
  is_prime[0] = is_prime[1] = false;
  for (long long i = 2; i <= n; i++) {
    if (is_prime[i] && (long long)i * i <= n) {
      for (long long j = i * i; j <= n; j += i) is_prime[j] = false;
    }
  }
}
void dfs(long long s, vector<bool> &v, vector<long long> adj[]) {
  if (v[s]) return;
  v[s] = true;
  cout << s + 1 << " ";
  for (auto u : adj[s]) {
    dfs(u, v, adj);
  }
}
void bfs(vector<pair<long long, long long> > &dis, vector<long long> adj[],
         long long s, vector<long long> &parent) {
  dis[s].first = 0;
  parent[s] = -1;
  queue<long long> q;
  q.push(s);
  while (!q.empty()) {
    long long z = q.front();
    q.pop();
    dis[z].second = 0;
    for (long long v : adj[z]) {
      if (dis[v].first == -1) {
        dis[z].second = -1;
        q.push(v);
        dis[v].first = dis[z].first + 1;
        parent[v] = z;
      }
    }
  }
}
vector<long long> primes;
void storePrime(long long n) {
  validateprime(n);
  for (long long i = 0; i < n; i++) {
    if (is_prime[i + 1]) {
      primes.push_back(i + 1);
    }
  }
}
void srihrg() {
  long long n, x;
  cin >> n >> x;
  string s;
  cin >> s;
  long long bn = 0;
  long long cn = 0;
  long long yu = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '0') {
      yu++;
    }
  }
  yu = 2 * yu - n;
  bool k = 0;
  for (long long i = 0; i < n; i++) {
    if (yu == 0) {
      if (bn == x) k = 1;
    } else {
      if ((x - bn) % abs(yu) == 0) {
        if ((x - bn) * yu >= 0) {
          cn++;
        }
      }
    }
    if (s[i] == '0')
      bn++;
    else
      bn--;
  }
  if (k) {
    cout << -1;
  } else {
    cout << cn;
  }
}
int main(int argc, const char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long query = 1;
  cin >> query;
  for (long long queryit = 1; queryit <= query; queryit++) {
    srihrg();
    cout << endl;
  }
  return 0;
}