#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;



#define MOD 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define INF (int)1e9
#define fora(i,a,b) for(ll i=a;i<b;i++)
#define forn(n) for(ll i=0; i<n; i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fir first
#define sec second
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp(x,y) make_pair(x,y)
#define mli map<ll,int>
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define sortv(v) sort(v.begin(), v.end())
#define minv(v) min_element(v.begin(), v.end())
#define maxv(v) max_element(v.begin(), v.end())
#define ubv(v,n) upper_bound(v.begin(), v.end(), n)
#define lbv(v,n) lower_bound(v.begin(), v.end(), n)
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll gcd(ll a,ll b){
    if (b==0)return a;
    return gcd(b,a%b);
    
}
void solve()
{
    ll n,k;
    cin>>n>>k;
ll arr[n];
for(ll i=0;i<n;i++)
{
    cin>>arr[i];
}
ll sum=arr[0],ans=0;
for(ll i=1;i<n;i++)
{
    ll ab=arr[i];
    if((100*ab)<=k*sum)
    {
        //cout<<sum<<endl;
        sum+=ab;
        //cout<<sum<<" "<<tmp<<endl;
        continue;
    }
    else
    {
        ll tba,ppp;
        //cout<<sum<<endl;
        if((100*ab)%k==0)
        {
            tba=100*(ab)/k;
            //cout<<tba<<endl;
        }
        else
        {
            tba=100*(ab)/k;
            tba++;
            //cout<<tba<<endl;
        }
        
        ppp=tba-sum;
        //ll ooo=ppp-ab;
        //cout<<ppp<<" "<<tba<<" "<<ab<<endl;
        sum+=ppp;
        sum+=ab;
        ans+=ppp;
        continue;
    }
}
cout<<ans<<endl;
    return;
}

int main()
{
fast;
ll t;
cin>>t;
//t=1;
while(t--)
{
solve();
}
    return 0;
}
//0xAAAAAAAA=even bits set to 1 ; 0x55555555 = odd bits set to 1