#include<bits/stdc++.h>
#include<algorithm>
#define ll long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testcases;
    cin>>testcases;
    while(testcases--){
    	int n,k;
    	cin>>n>>k;
    	unsigned ll sum = 0 ;
    	cin>>sum;
    	unsigned ll diff = 0;
    	for (int i = 0; i < n-1; ++i)
    	{
    		ll current;
    		cin>>current;
    		double thiscase = (1.00*sum) / current ;
    		if(thiscase < (100.00/k)){
    			ll currentdiff = ceil((100.00*current) / k) - sum;
    			diff += currentdiff;
    			sum += currentdiff;
    		}  
    		sum+= current;
    	}
    	cout<<diff<<"\n";
    }
return 0;
}