#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=b-1;i>=a;i--)
#define mod 1000000007
#define pb push_back
#define son ll t; cin>>t;while(t--)
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL);
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define mpr make_pair
#define ff first
#define ss second
#define inf 5e18
#define dex(x,y) fixed<<setprecision(x)<<y
void start()
{
  #ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #endif
}

int32_t main()
{
    fst
   // start();
    son
    {
     int n,k;
      cin>>n>>k;
      int a[(int)n];
      fr(i,0,n)
      cin>>a[i];
      long double s=k/100.00;
      long double b[(int)n];
      int sum=a[0];
//cout<<s<<' ';
      int c=0;
      fr(i,1,n)
      {
            int x = k*sum;
            int y = a[i]*100;
       
            if (x<y)
            {
                int val = (y-x)/k+((y-x)%k!=0);
         
                c+=val;
                sum+=val;
            }
            sum+=a[i];
          
      
    }
    
      
      cout<<c<<endl;
 
    }
}
/*20100 100
20101 20200
20402 20200
99
100 100
200 100
0*/