#include <bits/stdc++.h>

using namespace std;

int t;
int sum[500000];
long long res[10];


void solve(int qq)
{
    int n, q, e;
    long long ans = 0;
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; i++)
        sum[i] = 0;
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &e);
        if (i > 0)
            sum[i] = sum[i-1];
        if (e == 1)
            sum[i] += 1;
    }



    for (int i = 0; i < n; i++)
    {
        int s = 0, vs = 0;
        for (int j = i; j < n; j++)
        {
            vs = j - i + 1;
            if (i > 0)
                s = sum[j] - sum[i-1];
            else
                s = sum[j];

            if (int(s*100.0/(vs*1.0)) >= q)
                ans++;
        }
    }
    res[qq] = ans;


}

int main()
{
    cin >> t;
    for (int qqq = 0; qqq < t; qqq++)
        solve(qqq);
    for (int qqq = 0; qqq < t; qqq++)
        cout << res[qqq] << ' ';

    return 0;
}
