#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; 
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#pragma GCC optimize "trapv"
#define _GLIBCXX_DEBUG
#define ll long long int
#define ld long double
#define ull unsigned long long int  // ranges from (0 - twice of long long int)
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define vll vector<ll>
#define mod 1000000007LL
#define llpair pair<ll,ll>
#define INF 1000000000000000000ll
#define np next_permutation
#define PI acos(-1)
#define deb(x) cout<<#x<<" "<<x<<endl;
#define rotate_left(vec,amt) rotate(vec.begin(),vec.begin()+amt,vec.end());
#define rotate_right(vec,amt) rotate(vec.begin(),vec.begin()+vec.size()-amt,vec.end());
#define all(x) x.begin(),x.end()
#define sortall(x) sort(all(x))
#define clr(x) memset(x,0,sizeof(x))
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pbds;

// It doesn't matter how Slowly you go,as long as you do not stop.
// What is my Aim:->(SELF SATISFACTION that I have done my BEST).

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://x...content-available-to-author-only...i.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
// This is used when We want to use pairs in unordered_map and unordered_set
struct pair_hash
{
    template <class T1, class T2>
    std::size_t operator() (const std::pair<T1, T2> &pair) const
    {
        return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
    }	
};


bool check(ll mid, ll arr[], ll n, ll pre[], ll k)
{
	for(ll i=1;i<n;i++)
	{
		ll curr_prefix= pre[i-1] + mid;
		if((double)curr_prefix/arr[i]>=(double)100/k)
		continue;
		else
		return false;
	}
	
	return true;
}

int main() {
    auto start = chrono::high_resolution_clock::now();
    fio;
    ll t=1; 
    cin>>t;
	while(t--)
	{
		ll n,k; cin>>n>>k;
		
		ll arr[n]; rep(i,0,n) cin>>arr[i];
		
		ll pre[n];
		pre[0]=arr[0];
		for(int i=1;i<n;i++)
		pre[i]=pre[i-1] + arr[i];
		
		
		ll low=0;
		ll high=1e18;
		
		
		while(low<high)
		{
			ll mid = (low) + (high-low)/2;
			if(check(mid,arr,n,pre,k))
			high=mid;
			else
			low=mid;
			
			if(high-low==1) break;
		}
		
		if(check(low,arr,n,pre,k))
		cout<<low<<"\n";
		else
		cout<<high<<"\n";
		 
	}
	
    auto finish = chrono::high_resolution_clock::now();
    cerr << "Time elapsed: " << (chrono::duration<long double>(finish-start)).count() << "s\n";
    return 0;
            
}

