#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);
#define ll long long int
#define pb push_back
#define mk make_pair
#define mt make_tuple
#define fi first
#define se second
#define test ll var;  cin>>var; while(var--)
#define vll vector<ll>
#define sll set<ll>
#define stt stack<ll>
#define qll queue<ll>
#define all(v) v.begin(),v.end()
#define lb(vec,num) lower_bound(vec.begin(),vec.end(),num)-vec.begin()
#define ub(vec,num) upper_bound(vec.begin(),vec.end(),num)-vec.begin()
#define vpp vector<pair<ll,ll>>
#define mxx(v) *(max_element(v.begin(),v.end()))
#define mnn(v) *(min_element(v.begin(),v.end()))
#define mpp map<ll,ll>
#define pp push
#define reset(v) memset(v,0,sizeof(v))
#define mod 1000000007
#define smm(i,j,k) accumulate(v.begin()+i,v.begin()+j, k);
#define mod1 998244353
#define PII pair<ll,ll>
#define f(i,size) for(i=0;i<size;i++)
#define f1(i,size) for(i=1;i<=size;i++)
#define INF LLONG_MAX
#define endl '\n'

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1; 
    x = x % p; 
    while (y > 0) { 
        if (y & 1) 
            res = (res * x) % p; 
        y = y >> 1; 
        x = (x * x) % p; 
    } 
    return res; 
}




int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    fastio
    
    test
    {
        ll i,j,k,l,m,n;

        cin>>n>>k;
        ll a[n];

        f(i,n)cin>>a[i];


        ll ans=0;
        ll p,q,r,s,x,y;

        for(i=0;i<n-1;i++)
        {
            if(i>0)
                a[i]+=a[i-1];

            p=a[i+1]*100;
            q=(k*(ans+a[i]));

            

            if(p>q)
            {
                p=(ans+a[i])*k;
                q=(100*a[i+1]);

                
                q-=p;

                if(q%k)
                    ans++;

                q/=k;


                ans+=q;
            }


        }

        cout<<ans<<endl;

    }

}