#include<bits/stdc++.h>
#define pb emplace_back
#define pf first
#define ps second
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl '\n'
#define mod 1000000007
#define INF 1000000001
#define forn(i,n) for(ll i=0;i<n;i++)
#define MAX 200001
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

//////////////////////////////////// JAI SHREE RAM /////////////////////////////////////

void JAISHREERAM()
{
    ll n,i,k,j,ans=0;
    cin>>n>>k;
    vector<ll> a(n);
    forn(i,n) cin>>a[i];
    ll sum=a[0];
    for(i=1;i<n;i++)
    {
        ll l=0,r=1e17,mn=r;
        while(l<=r)
        {
            ll m=(l+r)/2;
            ll x=a[i]*100-(k*(m+sum+ans));
            if(x<=0) mn=m,r=m-1;
            else l=m+1;
        }
        ans+=mn;
        sum+=a[i];
    }
    cout<<ans<<endl;
}
int main()
{
    fast;
    int T=1;
    cin>>T;
    for(int t=1;t<=T;t++)
    {
        JAISHREERAM();
    }
    return 0;
}