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>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC optimization("O3")
using namespace std;
const unsigned long long mod = 1000000007;
const long long inf = ((1ll << 31ll) - 1ll);
const long long INF = (((1ll << 59ll) - 1ll) * 2ll) + 1ll;
const long double pi = acos(-1);
const long long MAXN = 100000;
vector<bool> Criba(MAXN + 1);
void iniciar_criba() {
  for (long long i = 2; i <= MAXN; i += 2) Criba[i] = 2;
  for (long long i = 3; i <= MAXN; i += 2) {
    if (!Criba[i]) {
      Criba[i] = i;
      for (long long j = i * i; j <= MAXN; j += (2 * i))
        if (!Criba[j]) Criba[j] = i;
    }
  }
}
bool isprime(long long tupac) { return (Criba[tupac] == tupac); }
long long GCD(long long q, long long r) {
  if (r == 0) return q;
  return GCD(r, q % r);
}
long long LCM(long long q, long long r) { return q * (r / GCD(q, r)); }
long long qpow(long long b, long long e) {
  if (!e) return 1;
  if (e & 1) return qpow(b, e - 1) * b % mod;
  long long pwur = qpow(b, e >> 1);
  return pwur * pwur % mod;
}
long long InverM(long long a, long long b) {
  long long eso = a - (a / b) * b;
  if (eso == 0) return 0;
  long long ans = (1 - b * InverM(b, eso)) / eso;
  if (ans < 0) ans += b;
  return ans;
}
long long t, n, D, m, k, bL, bR;
void problem() {
  long long x;
  vector<long long> Flag;
  cin >> n >> x;
  for (long long i = 0; i <= 2 * n; i++) {
    Flag.push_back(0);
  }
  string s;
  cin >> s;
  long long au = 0;
  long long L = 0;
  long long R = 0;
  for (long long i = 0; i < n; i++) {
    Flag[au + n]++;
    if (s[i] == '1')
      au--;
    else
      au++;
    L = min(L, au);
    R = max(R, au);
  }
  if (au == 0) {
    if (x >= L && x <= R) {
      cout << -1;
      return;
    } else {
      cout << 0;
      return;
    }
  }
  if (au > 0) {
    if (x < L) {
      cout << 0;
    } else {
      long long cont = 0;
      if (x > R) {
        long long a = (x - R - 1) / au;
        x -= (a + 1) * au;
      }
      while (x >= L) {
        cont += Flag[x + n];
        x -= au;
      }
      cout << cont;
      return;
    }
  } else {
    if (x > R) {
      cout << 0;
    } else {
      long long cont = 0;
      if (x < L) {
        long long a = (L - x - 1) / (-au);
        x += (a + 1) * (-au);
      }
      while (x <= R) {
        cont += Flag[x + n];
        x -= au;
      }
      cout << cont;
      return;
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(0);
  srand(time(NULL));
  cin >> t;
  while (t--) {
    problem();
    cout << '\n';
  }
  return 0;
}