#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
ll n, k;
vl a;
bool binse(ll tr)
{
    vl yup=a;
    yup[0]+=tr;
    ll current=yup[0];
    forr1(i, n-1)
    {
        //cout<<current<<' '<<a[i]<<' ';
        //std::cout<<setprecision(10)<<a[i]*100.0/(current)<<endl;
        if(a[i]*100<=k*current)
        {
            current+=a[i];
        }
        else
        {
            return false;
        }
    }
    return true;
}
void solve()
{
    cin>>n>>k;
    a.clear();
    a.resize(n);
    forr(i, n) cin>>a[i];
    ll low=0, high=(ll)1e17;
    ll ans=high;
    while(high>=low)
    {
        ll mid=low+(high-low)/2;
        //cout<<mid<<endl;
        if(binse(mid))
        {  
            ans=mid;
            high=mid-1;
        }
        else
        {
            low=mid+1;
        }
    }
    //cout<<binse(99)<<endl;
    cout<<ans<<endl;
}
int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}