#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll ,ll> pll;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define REP(i,x,y) for(ll i = x;i <= y;++i)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
vector<string> vec_splitter(string s) {
    for(char& c: s) c = c == ','?  ' ': c;
    stringstream ss; ss << s;
    vector<string> res;
    for(string z; ss >> z; res.push_back(z))
        ;
    return res;
}
void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
    if(idx > 0) cerr << ", ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __VA_ARGS__)
void localTest() {
    #ifndef ONLINE_JUDGE
        freopen("inp", "r", stdin);
        freopen("out", "w", stdout);
    #endif      
}
int main() {

    localTest();
    fastio;
    ll t;
    cin >> t;
    while(t--) {
        ll n, k, tot = 0;
        cin >> n >> k;
        vector<ll> P(n);
        for(auto &x : P) {
            cin >> x;
            tot += x;
        }
        ll lo = 0, hi = 1e15, ans = hi;
        while(lo <= hi) {
            ll mid = (lo + hi) >> 1;
            ll curr = P[0] + mid, fl = 1;
            for(ll i = 1; i < n; ++i) {
                if(P[i] * 100 > k * (curr)) {
                    fl = 0;
                    break;
                }
                curr += P[i];
            }
            if(fl) {
                hi = mid - 1;
                ans = mid;
            } else {
                lo = mid + 1;
            }
        }
        cout << ans << "\n";
    }

    return 0;
}