#include <bits/stdc++.h>
using namespace std;
  
#define fst ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define tc int tt; cin >> tt; while(tt--) 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

const int N = 3e5 + 6, mod = 1e9 + 7, INF = 1e16 + 6;	

int power(int a, int n) {
	int res = 1;
	while(n) {
		if(n&1) res = (res*a)%mod;
		n >>= 1;
		a = (a*a)%mod;
	}
	return res;
}

bool ok(int a[], int n, int x, int k) {
	int sum = a[0] + x;
	for(int i=1;i<n;++i) {
		if(a[i]*100 > k*sum) return 0;
		sum += a[i];
	}
	return 1;
}

int32_t main()
{
	fst
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout); 
	#endif
	
	tc {
		int n, k;
		cin >> n >> k;
		int a[n];
		for(int i=0;i<n;++i) cin >> a[i];

		int l = 0, r = 1e14 + 4, ans = 0;
		while(l <= r) {
			int m = (l + r) >> 1LL;
			if(ok(a, n, m, k)) {
				ans = m;
				r = m - 1;
			}
			else l = m + 1;
		}
		cout << ans << "\n";
	}
}
