#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a) for(int i = 0; i < (int) a; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void solve(){
	int n, k; cin >> n >> k;
	vector<ll> v(n); FOR(i, n) cin >> v[i];

	ll sum = v[0], ans = 0;
	for(int i = 1; i < n; i++){
		if(v[i] * 100 > sum * k){
			ans += (v[i] * 100 - sum * k + k - 1) / k;
			sum += (v[i] * 100 - sum * k + k - 1) / k;
		}
		sum += v[i];
	}

	cout << ans << '\n';
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0);

	int t=1; cin >> t;
	while(t--){
		solve();
	}

	return 0;
}