#include<bits/stdc++.h>

#define ll long long
#define ldu long double


using namespace std;

const int maxn = 1e3 * 1 + 5;
ll t;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> t;
    ldu k,sum;
    ldu pr[maxn], n; ll l = 0, r= 1e10,mid;

    for (; t>0; t--) {
        cin >>  n >> k;
        l = -1;r= 1e12;
        for(int i=0; i <n; i++)
            cin >> pr[i];
        
        for (; l < r-1;) {
            mid = (l+r)/2;
            bool check = 1;
            sum = pr[0];
            for (int i=1; i<n; i++) {
                if ((double)(pr[i]*100) > (double)(k*(sum+mid)))
                {
                    check = 0;
                    break;
                }
                sum += pr[i];
            }
            if (check) {
                r = mid;
            }
            else
                l = mid;
        }
        cout << r << endl;
    }

    return 0;
}