//  “Alhamdulillah for Everything”
#include<bits/stdc++.h>
using namespace std;

#define      pai              acos(-1)
#define      ff               first
#define      ss               second
#define      ll               long long
#define      pb               push_back
#define      mp               make_pair
#define      pll              pair<ll,ll>
#define      sz(a)            (ll)a.size()
#define      endl             "\n"
#define      gcd(a, b)        __gcd(a, b)
#define      lcm(a, b)        ((a*b)/gcd(a,b))
#define      all(vec)         vec.begin(),vec.end()
#define      ms(a, b)         memset(a,b,sizeof(a))
#define      rep(i,n)         for(int i= 0; i < int(n); i++)
#define      rep1(i,n)        for(int i= 1; i <= n; i++)
#define      TEST_CASE(t)     for(int zz=1;zz<=t;zz++)
#define      PRINT_CASE       printf("Case %d: ",zz)
#define      fii              freopen("input.txt","r",stdin);
#define      foo              freopen("output.txt","w",stdout);
#define      boom             ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

const ll M   = 1e9+7;
const ll mxn = 1e5+7;
const ll inf = 1e18;

int  main()
{
    //boom;
    ll i,j,k,a,b,c,d,n,m,t,x,y,z,u,v;
    cin>>t;
    TEST_CASE(t)
    {
        cin>>n>>k;
        vector<ll>vec(n);
        for(i=0;i<n;i++)
        {
            cin>>vec[i];
        }
        ll ans=0,sum=vec[0];
        for(i=1;i<n;i++)
        {
            a=vec[i]*100;
            b=sum*k;
            if(a<b)
            {
                sum+=vec[i];
            }
            else
            {
                ll tem=a-b+k-1;
                tem/=k;
                sum+=(vec[i]+tem);
                ans+=tem;
            }
            //cout<<i<<"==="<<sum<<"===="<<ans<<endl;
        }
        cout<<ans<<endl;
    }
    return 0;
}
