#include <stdio.h>

using namespace std;

int main(int argc, char *argv[])
{
    int t = 0;
    scanf("%d",&t);
    for (int j = 0; j < t; j++){
       int n,q;
       scanf("%d %d", &n, &q);
       int a[n];
       for (int i = 0; i < n; i++){
         scanf("%d",a+i);
       }
       int k = 0;
       for (int i = 0; i < n; i++)
         for (int y = i; y < n; y++){
           int good = 0;
           for (int o = i; o <= y && ((double)good)/((double)(y-i+1))*100 < q; o++){
               if (a[o] == 1)
                 good++;
           }
           if (((double)good)/((double)(y-i+1))*100 >= q)
             k++;
         }
       printf("%d ",k);
    }
      
    return 0;
}
