#include<bits/stdc++.h>
#define ll long long int
#define vl vector<ll> 
using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll n;
        ll k;
        cin>>n;
        cin>>k;
        ll initial;
        cin>>initial;
        ll ans =0;
        for(int i=0;i<n-1;i++)
        {
            double x;
            cin>>x;
            double zero =0;
            ll add=max(zero,ceil(((x*100)-(initial*k))/k));
            //cout<<ans<<endl;
            initial +=add;
            initial+=x;
            ans += add;
           // cout<<"INITIAL "<<initial<<endl;
        }
        cout<<ans<<endl;
       
    }
}