#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t,a;
    cin>>t;
    while(t--)
    {
    	int n,k,i;
    	cin>>n>>k;
    	ll p[n];
    	for (int i = 0; i < n; ++i)
    	{
    		cin>>p[i];
    	}
    	ll sum=p[0],count=0;
    	for (int i = 1; i < n; ++i)
    	{
    		if(sum*k<p[i]*100)
    		{
    			if((p[i]*100)%k)
    			{
    				count+=(p[i]*100)/k+1-sum;
    				sum=(p[i]*100)/k+1;
    			}
    			else
    			{
    				count+=(p[i]*100)/k-sum;
    				sum=(p[i]*100)/k;
    			}
    		}
    		
    			sum+=p[i];
    	}
    	cout<<count<<endl;
    	
    	
    

    }

    return 0;
}