/*Author:: Abhinav20*/
#pragma GCC optimize ("-O3")
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define f(i,x,n) for(ll i=x;i<n;i++)
#define pb push_back
#define mp make_pair
#define debug(x) cout<<x<<"\n";
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define MOD 1000000007
ll n,k,a,b,c,d,x,y,z,m;
ll arr[200000];
ll brr[200000];
int  main()
{
     ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   //std::cout << fixed<< std::setprecision(9) << '\n';
  
   int  t;
    t=1;
    cin>>t;
    while(t--)
    {  
      cin>>n>>k;
      for(int i=0;i<n;i++)
      {
      	cin>>arr[i];
	  }
	  ll ans=0;
	  ll sum=arr[0];
	  for(int i=1;i<n;i++)
	  {    
	      if(double(arr[i])/sum>double(k)/100)
	      {
	      	ll temp=ceil(double(100*arr[i])/k);
	      	ans+=temp-sum;
	      	sum+=temp-sum;
	      	sum+=arr[i];
		  }
	  	
	  	else
	  	{
	  		sum+=arr[i];
		  }
	  	
	  }
	  cout<<ans<<endl;
       
}
	  
}

//
         
     
         
         
     