#include<stdio.h>
#include<string.h>
#include<math.h>
#define ll long long int
#define llu unsigned long long int
#define FOR(i, t) for(int i = 0;i < (t);i++)
#define PI 3.14159265359
#define MOD 1000000007
//
//
// 2 2 2 2 2

// 7 6
//
// 
// 
// 2
ll a[1005];
int main()
{
	int t, n;
	ll sum, ans, k;
	double res;
	scanf("%d", &t);
	for(int i = 0;i < t;i++)
	{
		scanf("%d %lld", &n, &k);
	    sum = 0, ans = 0;
		for(int j = 0;j < n;j++)
		{
		    scanf("%lld", &a[j]);
		    
		    if(j == 0)
		    {
		    	sum = a[j];
		    	continue;
			}
			res = ((double)a[j] * 100.0)/((double) sum * 1.0);
//			printf("%lf %lld %lld\n", res, sum, (a[j] * 100 * k));
			if(res > k)
			{
				ans +=  ((a[j] * 100)/k) - sum;
				sum += ((a[j] * 100)/k) - sum;
				res = ((double)a[j] * 100.0)/((double) sum * 1.0);
				while(res > k)
				{
					sum++;
					ans++;
					res = ((double)a[j] * 100.0)/((double) sum * 1.0);
				}
			}
			sum += a[j];
		}
		printf("%lld\n", ans);
	}
	return 0;
}
