You have a statistic of price changes for one product represented as an array of $n$ positive integers $p_0, p_1, \dots, p_{n - 1}$, where $p_0$ is the initial price of the product and $p_i$ is how the price was increased during the $i$-th month.

Using these price changes you are asked to calculate the inflation coefficients for each month as the ratio of current price increase $p_i$ to the price at the start of this month $(p_0 + p_1 + \dots + p_{i - 1})$.

Your boss said you clearly that the inflation coefficients must not exceed $k$ %, so you decided to increase some values $p_i$ in such a way, that all $p_i$ remain integers and the inflation coefficients for each month don't exceed $k$ %.

You know, that the bigger changes — the more obvious cheating. That's why you need to minimize the total sum of changes.

What's the minimum total sum of changes you need to make all inflation coefficients not more than $k$ %?


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The first line of each test case contains two integers $n$ and $k$ ($2 \le n \le 100$; $1 \le k \le 100$) — the length of array $p$ and coefficient $k$.

The second line of each test case contains $n$ integers $p_0, p_1, \dots, p_{n - 1}$ ($1 \le p_i \le 10^9$) — the array $p$.


-----Output-----

For each test case, print the minimum total sum of changes you need to make all inflation coefficients not more than $k$ %.


-----Examples-----

Input
2
4 1
20100 1 202 202
3 100
1 1 1
Output
99
0


-----Note-----

In the first test case, you can, for example, increase $p_0$ by $50$ and $p_1$ by $49$ and get array $[20150, 50, 202, 202]$. Then you get the next inflation coefficients:

$\frac{50}{20150} \le \frac{1}{100}$;

$\frac{202}{20150 + 50} \le \frac{1}{100}$;

$\frac{202}{20200 + 202} \le \frac{1}{100}$;

In the second test case, you don't need to modify array $p$, since the inflation coefficients are already good:

$\frac{1}{1} \le \frac{100}{100}$;

$\frac{1}{1 + 1} \le \frac{100}{100}$;

Difficulty: EASY

Solutions:
from math import ceil

def solve(n, k, p):
	l = [p[0]]
	for i in range(n - 1):
		l.append(l[-1] + p[i + 1])
	c = [p[i + 1] * 100 - k * l[i] for i in range(n - 1)]
	c = max(c)
	print(ceil(c / k) if c > 0 else 0)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	solve(n, k, p)


t = int(input())

def ans(n, k, p):
	res = 0
	x = 0
	den = p[0]
	i = 1
	while i < n:
		if p[i] / den > k / 100:
			if p[i] * 100 % k == 0:
				x = 100 * p[i] // k - den
			else:
				x = 100 * p[i] // k - den + 1
			res += x
			den += x
		den += p[i]
		i += 1
	return int(res)
for i in range(t):
	a = list(map(int, input().strip().split()))[:2]
	n = a[0]
	k = a[1]
	p = list(map(int, input().strip().split()))[:n]
	pj = ans(n, k, p)
	print(pj)


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	arr = [int(x) for x in input().split()]
	total = arr[0]
	for i in range(1, len(arr)):
		if arr[i] / total > k / 100:
			total = math.ceil(arr[i] * 100.0 / k)
		total = total + arr[i]
	print(total - sum(arr))


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	aa = arr[0]
	z = 0
	for j in range(1, n):
		z = max(z, (arr[j] * 100 - k * aa) / k)
		aa += arr[j]
	print(ceil(z))


from sys import stdin, stdout
from math import ceil
for _ in range(int(stdin.readline())):
	(n, k) = [int(x) for x in stdin.readline().split()]
	p = [int(x) for x in stdin.readline().split()]
	a = p[0]
	s = 0
	for i in range(1, n):
		if p[i] / a > k / 100:
			s = max(s, ceil(p[i] * 100 / k) - a)
		a += p[i]
	print(s)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = l[0]
	c = 0
	for j in range(1, n):
		if l[j] / s > k / 100:
			f = l[j] * 100 // k - s
			if l[j] * 100 % k != 0:
				f = f + 1
			s = s + f
			c = c + f
		s = s + l[j]
	print(c)


def solve():
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))

	def f(m):
		gsum = p[0] + m
		for i in range(1, n):
			if p[i] / gsum > k / 100:
				return False
			gsum += p[i]
		return True
	m = 0
	l = -1
	r = 10 ** 18
	while r - l > 1:
		m = (l + r) // 2
		if f(m):
			r = m
		else:
			l = m
	print(r)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	curr = a[0]
	for i in range(1, n):
		if a[i] / curr <= k / 100:
			curr += a[i]
			continue
		extra = (a[i] * 100 - k * curr) // k
		ans += extra
		curr += extra
		if a[i] / curr > k / 100:
			curr += 1
			ans += 1
		curr += a[i]
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	change = 0
	cur = p[0]
	for i in range(1, n):
		left = p[i] * 100
		right = k * cur
		if left > right:
			deltwo = (left - right + (k - 1)) // k
			change += deltwo
			cur += deltwo
		cur += p[i]
	print(change)


from math import ceil
for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	S = p[0]
	ans = 0
	for i in range(1, n):
		if p[i] / S > k / 100:
			a = ceil(p[i] * 100 / k - S)
			ans += a
			S += a
		S += p[i]
	print(ans)


def db(*arg):
	print(*arg)
T = int(input())
ans_ls = [0] * T
for t in range(T):
	(N, K) = map(int, input().split())
	p_ls = list(map(int, input().split()))
	now_sum = p_ls[0]
	ans = 0
	for i in range(1, N):
		ans += max(-(-(100 * p_ls[i] - K * now_sum) // K), 0)
		now_sum += max(-(-(100 * p_ls[i] - K * now_sum) // K), 0)
		now_sum += p_ls[i]
	ans_ls[t] = ans
for ans in ans_ls:
	print(ans)


import sys
inf = sys.stdin
input = inf.readline

def read_one_int():
	return int(input().rstrip('\n'))

def read_list_of_ints():
	res = [int(val) for val in input().rstrip('\n').split(' ')]
	return res

def check_seq(k, seq):
	res = 0
	sum_denom = 0
	for p in seq:
		if not sum_denom:
			sum_denom += p
			continue
		if p / sum_denom <= k / 100:
			sum_denom += p
			continue
		else:
			comp = 0.0
			if p * 100 % k:
				comp = 1.0
			to_add = int(p * 100 / k + comp) - sum_denom
			sum_denom += to_add + p
			res += to_add
	return res

def main():
	samples = read_one_int()
	res = ''
	for _ in range(samples):
		n_k = read_list_of_ints()
		seq = read_list_of_ints()
		res = check_seq(n_k[1], seq)
		print(res)
main()


for _ in range(int(input())):
	(n, k) = [*map(int, input().split())]
	a = [*map(int, input().split())]
	su = 0
	count = 0
	final = 0
	ans = k / 100
	for i in range(1, n):
		su += a[i - 1]
		op = a[i] / su
		if op > ans:
			ml = su
			x = a[i] / ans - ml
			x = int(x)
			if a[i] / (ml + x) <= ans:
				count += x
				su += x
			else:
				x += 1
				count += x
				su += x
	print(int(count))


from math import ceil
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	alp = list(map(int, input().split()))
	out = 0
	x = alp[0]
	for i in range(1, len(alp)):
		if 100 * alp[i] / x > k:
			out = max(out, (100 * alp[i] - k * x) / k)
		x += alp[i]
	print(int(ceil(out)))


from sys import stdin
from collections import Counter
from math import pow, sqrt, factorial, log10, log, ceil, floor
from itertools import permutations, combinations, combinations_with_replacement
input = stdin.readline

def solve(n, k, a):
	p = a[0]
	ans = 0
	for i in range(1, n):
		if a[i] / p <= k / 100:
			p += a[i]
		else:
			x = ceil(a[i] * 100 / k)
			ans += x - p
			p = x
			p += a[i]
	print(ans)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	solve(n, k, a)


t = int(input())
for i in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(n, k) = (L[0], L[1])
	ch = input()
	L = [int(i) for i in ch.split()]
	x = 0
	s = 0
	for i in range(1, n):
		x = max(x, 100 * L[i] - s * k)
		s += L[i]
	if x % k == 0:
		print(max(0, x // k - L[0]))
	else:
		print(max(0, 1 + x // k - L[0]))


import math

def solve(n, k, seq):
	index = 1
	ans = 0
	currentSum = seq[0]
	newDivisor = 0
	while index < n:
		if seq[index] / currentSum > k / 100:
			newDivisor = math.ceil(seq[index] * 100 / k)
			ans += newDivisor - currentSum
			currentSum = newDivisor
		currentSum += seq[index]
		index += 1
	return ans
for x in range(int(input())):
	(n, k) = list(map(int, input().split()))
	seq = list(map(int, input().split()))
	print(solve(n, k, seq))


import sys
import os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
depth = 1000005
mod = 1000000007
sys.setrecursionlimit(depth)
from math import inf, ceil
from collections import defaultdict
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(den, cost) = (a[0], 0)
	for i in range(1, n):
		if 100 * a[i] > k * den:
			val = 100 * a[i] - k * den
			val = ceil(val / k)
			cost += val
			den += val
		den += a[i]
	print(cost)


from math import ceil
for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	s = a[0]
	res = 0
	for i in range(1, n):
		eff = a[i] / s
		if eff > k / 100:
			change = (100 * a[i] - s * k) / k
			change = ceil(change)
			s += change
			res += change
		s += a[i]
	print(res)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	lst = list(map(int, input().split()))
	answer = 0
	su = lst[0]
	for j in range(1, n):
		if lst[j] * 100 <= k * su:
			su += lst[j]
			continue
		if lst[j] * 100 % k == 0:
			x = lst[j] * 100 / k - su
		else:
			x = int(lst[j] * 100 / k) - su + 1
		answer += x
		su += x
		su += lst[j]
	print(int(answer))


import math

def inf(arr, k):
	summ = arr[0]
	res = 0
	for i in range(1, len(arr)):
		var = math.ceil(100 * arr[i] / k - summ)
		if var > res:
			res = var
		summ += arr[i]
	print(res)
t = int(input())
for i in range(0, t):
	nk = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	inf(arr, nk[1])


from math import ceil

def commerce(n, k, p):
	init = p[0]
	for i in range(1, n):
		if p[i] / sum(p[:i]) * 100 > k:
			p[0] += ceil(p[i] * 100 / k) - sum(p[:i])
	return p[0] - init
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	print(commerce(n, k, p))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	ans = 0
	now = p[0]
	for i in range(1, n):
		plus = max(0, (100 * p[i] + k - 1) // k - now)
		ans += plus
		now += plus
		now += p[i]
	print(ans)


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()

def FACT(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod
for _ in range(II()):
	(n, k) = MI()
	p = LI()
	s = p[0]
	ans = 0
	for i in range(1, n):
		temp = math.ceil(p[i] * 100 / k)
		ans += max(temp - s, 0)
		s = max(s, temp)
		s += p[i]
	print(ans)


innum = lambda : int(input())
inmul = lambda : map(int, input().split())
instr = lambda : str(input())
inarr = lambda : list(map(int, input().split()))

def solve():
	(n, k) = inmul()
	a = inarr()
	s = a[0]
	ans = 0
	for i in range(1, n):
		p = a[i] * 100
		if p > k * s:
			add = (p + k - 1) // k - s
			ans += add
			s += add
		s += a[i]
	print(ans)

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


def solve():
	(n, k) = [int(s) for s in input().split()]
	p = [int(s) for s in input().split()]
	total = 0
	most = 0
	for i in range(n - 1):
		total += p[i]
		current = p[i + 1] * 100 - total * k
		most = max(most, current // k + (current % k > 0))
	print(most)
t = int(input())
for test in range(t):
	solve()


t = int(input(''))
for i in range(t):
	(n, k) = map(int, input('').split())
	p = list(map(int, input('').split()))
	den = p[0]
	c = 0
	for j in range(1, n):
		num = p[j]
		d = 0
		if 100 * num > k * den:
			d = 100 * num // k - den
			if 100 * num % k != 0:
				d += 1
		den += num + d
		c += d
	print(c)


from math import *
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = l[0]
	m = 0
	for i in l[1:]:
		x = i * 100 / k - s
		m = max(m, x)
		s += i
	print(ceil(m))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	daf = list(map(int, input().split()))
	c = 0
	daf2 = 0
	x = 0
	for j in range(1, len(daf)):
		daf2 += daf[j - 1] + x
		if daf[j] * 100 / daf2 < k:
			x = 0
			continue
		x = math.ceil(daf[j] * 100 / k - daf2)
		c += x
		daf[0] += x
	print(c)


import math
t = int(input())
while t > 0:
	t = t - 1
	(n, k) = map(int, input().split())
	p = [int(k) for k in input().split()]
	j = []
	s = p[0]
	for i in range(1, n):
		if p[i] / s > k / 100:
			j.append(math.ceil(p[i] * 100 / k) - s)
		else:
			j.append(0)
		s += p[i]
	print(max(j))


for ushduashd in range(int(input())):
	(n, k) = map(int, input().split())
	L = list(map(int, input().split()))
	d = L[0]
	ans = 0
	for i in range(1, n):
		c = L[i] / d
		if not c <= k / 100:
			d1 = L[i] * 100 // k
			c = L[i] / d1
			if not c <= k / 100:
				d1 += 1
			ans += d1 - d
			d = d1
		d += L[i]
	print(ans)


t = int(input())
while t:
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	p = [int(x) for x in input().split()]
	sum = p[0]
	maxx = 0
	for i in range(1, n):
		delta = p[i] * 100 / k - sum
		if delta > 0:
			maxx = max(maxx, delta)
		sum = sum + p[i]
	if maxx % 1 != 0:
		maxx = int(maxx) + 1
	print(int(maxx))
	t -= 1


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = [int(x) for x in input().split()]
	dp = [0] * n
	temp = 0
	for i in range(n):
		dp[i] += temp
		temp += l[i]
	ans = 0
	for i in range(1, n):
		temp = l[i] * 100
		if temp > k * (dp[i] + ans):
			kl = math.ceil(temp / k)
			ans = kl - dp[i]
	print(ans)


t = int(input())
for l in range(0, t):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	zc = sum(s)
	p = 0
	for i in range(n - 1, 0, -1):
		zc -= s[i]
		if zc < s[i] * 100 / k:
			zj = s[i] * 100 // k + bool(s[i] * 100 % k) - zc
			zc += zj
			p += zj
	print(p)


import math

def solve(price, n, k):
	count = 0
	Psum = price[0]
	for i in range(1, n):
		temp = 100 * price[i] / k
		temp = math.ceil(temp)
		if Psum > temp:
			Psum += price[i]
		else:
			count += temp - Psum
			Psum = temp + price[i]
	return count
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	price = list(map(int, input().split()))
	print(solve(price, n, k))


import sys
input = sys.stdin.buffer.readline

def bs(med):
	add = a[0] + med
	for i in range(1, n):
		if a[i] / add > m / 100:
			return 0
		add += a[i]
	return 1
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	i = 0
	j = 10000000000000
	med = 0
	while i < j:
		med = (i + j) // 2
		if bs(med):
			j = med - 1
		else:
			i = med + 1
	if bs(i):
		print(i)
	else:
		print(i + 1)


t = int(input())
import math
for _ in range(t):
	[n, k] = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	prev_sum = arr[0]
	diffs = 0
	for i in range(1, n):
		if arr[i] / prev_sum <= k / 100:
			pass
		else:
			x = prev_sum
			prev_sum = math.ceil(arr[i] * 100 / k)
			diffs += prev_sum - x
		prev_sum += arr[i]
	print(diffs)


import math

def solve(n, p, k):
	total = sum(p)
	answer = 0
	for i in range(n - 1, 0, -1):
		val = p[i]
		total -= val
		if val / total > k / 100:
			answer += math.ceil(100 * val / k) - total
			total = math.ceil(100 * val / k)
	return answer
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	print(solve(n, p, k))


import math
t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split(' ')]
	a = [int(x) for x in input().split(' ')]
	sum = a[0]
	res = 0
	for j in range(1, n):
		element = a[j]
		if element * 100 / sum > k:
			c = math.ceil(100 * element / k - sum)
			sum += c
			res += c
		sum += a[j]
	print(res)


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def solve():
	for _ in range(int(input())):
		(n, k) = aj()
		(p0, *p) = aj()
		ans = 0
		for i in p:
			x = (i * 100 + k - 1) // k
			v = max(0, x - p0)
			p0 += v
			p0 += i
			ans += v
		print(ans)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
solve()


import math
import string

def main_function():
	test_cases = range(int(input()))
	for test_case in test_cases:
		(n, k) = [int(u) for u in input().split(' ')]
		real_k = k / 100
		p = [int(i) for i in input().split(' ')]
		inflation = [0]
		s = p[0]
		for i in range(1, len(p)):
			ratio = math.ceil(p[i] * 100 / k) - s
			inflation.append(ratio)
			s += p[i]
		print(max(max(inflation), 0))
main_function()


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def commonAllowedPrefix(s1, s2):
	for i in range(0, min(len(s1), len(s2))):
		if s1[i] > s2[i]:
			return i
	return min(len(s1), len(s2))
for xyz in range(0, int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	cp = l[0]
	ans = 0
	for i in range(1, n):
		if l[i] * 100 / cp <= k:
			cp += l[i]
		else:
			tba = math.ceil(100 * l[i] / k) - cp
			cp += tba + l[i]
			ans += tba
	print(ans)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	s = sum(a)
	for i in range(n - 1, 0, -1):
		s -= a[i]
		number = math.ceil(100 * a[i] / k)
		if s < number:
			s = number
	print(s - a[0])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	s = p[0]
	sum = p[0]
	for i in range(1, n):
		if p[i] / s > k / 100:
			s = int(100 * p[i] / k)
			if 100 * p[i] % k != 0:
				s += 1
		s += p[i]
		sum += p[i]
	print(s - sum)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	sum = l[0]
	for i in range(1, n):
		if sum < math.ceil(l[i] * 100 / k):
			ans += math.ceil(l[i] * 100 / k) - sum
			sum = math.ceil(l[i] * 100 / k)
		sum += l[i]
	print(math.ceil(ans))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = [*map(int, input().split())]
	p0 = p[0]
	s = 0
	for i in range(1, n):
		num = p[i]
		den = p0 + s
		if num * 100 > k * den:
			p0 = 100 * num / k - s
		s += p[i]
	print(math.ceil(p0) - p[0])


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
for _ in range(L()[0]):
	(n, k) = L()
	A = L()
	cost = 0
	sm = A[0]
	for i in range(1, n):
		if A[i] * 100 > sm * k:
			z = A[i] * 100 - sm * k
			z = ceil(z / k)
			cost += z
			A[i] += z
		sm += A[i]
	print(cost)
endtime = time.time()


import math
for t in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	l = [int(x) for x in input().split()]
	s = l[0]
	sol = 0
	for i in l[1:]:
		if i * 100 > s * k:
			x = math.ceil(i * 100 / k - s)
			sol += x
			s += x
		s += i
	print(sol)


T = int(input())
r = 1
while r <= T:
	(n, k) = map(int, input().split())
	incre = list(map(int, input().split()))
	ans = 0
	base = incre[0]
	for i in range(1, n):
		if incre[i] * 100 % k == 0:
			needed = incre[i] * 100 // k
		else:
			needed = incre[i] * 100 // k + 1
		if base + ans < needed:
			ans = needed - base
		base += incre[i]
	print(ans)
	r += 1


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ls = list(map(int, input().split()))
	presum = ls[0]
	req = 0
	for i in range(1, len(ls)):
		val = ls[i] * 100 / presum
		extras = 0
		if val > k:
			temp = 0
			temp += -presum + math.ceil(ls[i] * 100 / k)
			if temp == 0:
				temp = 1
			req += temp
			extras += temp
		presum += ls[i] + extras
	print(round(req))


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	c = 0
	s = p[0]
	for i in range(1, n):
		if p[i] * 100 / s > k:
			c = max(c, math.ceil(p[i] * 100 / k) - s)
		s += p[i]
	print(c)


def validate(arr, n, k, need):
	s = arr[0] + need
	limit = k / 100
	for i in range(1, n):
		curr = arr[i] / s
		if not curr <= limit:
			return False
		s += arr[i]
	return True

def solve(arr, n, k):
	low = 0
	high = 100000000000
	ans = float('inf')
	while low <= high:
		mid = (low + high) // 2
		if validate(arr, n, k, mid):
			ans = min(ans, mid)
			high = mid - 1
		else:
			low = mid + 1
	return ans
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	print(solve(arr, n, k))


from math import ceil

def fun(ls, n, k):
	val = n
	p0 = ls[0]
	ans = 0
	sum_till_previous = ls[0]
	for i in range(1, val):
		x = 100 * ls[i] / k - sum_till_previous
		if x > 0:
			sum_till_previous += ceil(x)
			ans += ceil(x)
		sum_till_previous += ls[i]
	print(ans)
T = int(input())
for i in range(T):
	(n, k) = list(map(int, input().split()))
	ls = list(map(int, input().split()))
	fun(ls, n, k)


import math
T = int(input())
for t in range(T):
	(n, k) = tuple([int(x) for x in input().split()])
	pp = [int(x) for x in input().split()]
	cur_sum = pp[0]
	change = 0
	for i in range(1, len(pp)):
		if k * cur_sum < 100 * pp[i]:
			new_cur_sum = (100 * pp[i] + k - 1) // k
		else:
			new_cur_sum = cur_sum
		change += new_cur_sum - cur_sum
		cur_sum = new_cur_sum + pp[i]
	print(change)


import math
t = int(input())
while t:
	t = t - 1
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	summ = 0
	for i in range(1, n):
		summ += p[i - 1]
		var = p[i] / summ * 100
		if var > k:
			q = math.ceil(p[i] * 100 / k) - summ
			summ += q
	summ += p[-1]
	print(abs(sum(p) - summ))


import sys
MOD = 1000000007
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_int():
	return int(sys.stdin.readline())

def get_line():
	return sys.stdin.readline().strip()

def write_line(out):
	return sys.stdout.write(str(out) + '\n')

def solve():
	(n, k) = get_ints()
	arr = list(get_ints())
	res = -1 * math.inf
	price = arr[0]
	for val in arr[1:]:
		if val / price > k / 100:
			diff = (100 * val - price * k) / k
			res = max(res, math.ceil(diff))
		price += val
	return res if res != -1 * math.inf else 0
t = get_int()
while t:
	write_line(solve())
	t -= 1


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	p = l[0]
	d = 0
	for i in l[1:]:
		d = max(d, (100 * i + k - 1) // k - p)
		p += i
	print(d)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	P = list(map(int, input().split()))
	originalSum = sum(P)
	currentSum = P[0]
	for j in range(1, n):
		if P[j] / currentSum * 100 > k:
			currentSum = math.ceil(P[j] * 100 / k)
		currentSum += P[j]
	result = currentSum - originalSum
	print(result)


t = int(input())
for i in range(t):
	m = input().split(' ')
	n = int(m[0])
	k = int(m[1])
	l = input().split(' ')
	for j in range(n):
		l[j] = int(l[j])
	s = l[0]
	x = 0
	p = s * k // 100
	for j in range(1, n):
		if l[j] > p:
			y = l[j] * 100
			if y % k == 0:
				y = y // k
			else:
				y = y // k + 1
			x = x + (y - s)
			s = y
		s += l[j]
		p = s * k // 100
	print(x)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	psum = p[0]
	mx = 1000000000000.0
	hi = mx
	lo = 0
	while lo <= hi:
		m = (lo + hi) // 2
		s = psum + m
		flag = True
		for i in range(1, n):
			if p[i] / s <= k / 100:
				s += p[i]
				continue
			flag = False
			break
		if flag:
			mx = m
			hi = m - 1
		else:
			lo = m + 1
	print(int(mx))


from itertools import accumulate
from sys import stdin, gettrace
if gettrace():

	def inputi():
		return input()
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(n, k) = map(int, input().split())
	pp = [int(a) for a in input().split()]
	ppp = list(accumulate(pp))
	res = 0
	for i in range(n - 2, -1, -1):
		c = max(0, (100 * (ppp[i + 1] - ppp[i]) - 1) // k + 1 - ppp[i])
		res += c
		for j in range(n):
			ppp[j] += c
	print(res)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


import math
from collections import defaultdict
DEBUG = False

def log(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)

class Solution:

	def __init__(self):
		pass

	def run(self):
		(n, k) = list(map(int, input().split()))
		prices = list(map(int, input().split()))
		pct = k / 100
		current = prices[0]
		result = 0
		for i in range(1, n):
			if prices[i] / current > pct:
				change = prices[i] * 100 // k + (prices[i] * 100 % k > 0) - current
				if change > 0:
					log(i, prices[i], current, prices[i] / current, k / 100, change)
					result += change
					current += prices[i] + change
			else:
				current += prices[i]
		return int(result)
t = int(input())
s = Solution()
for i in range(t):
	print(s.run())


import sys
input = sys.stdin.readline
from fractions import Fraction
from math import ceil

def solve(n, k, a):
	res = 0
	cumsum = a[0]
	for i in range(1, n):
		if Fraction(a[i], cumsum) <= k:
			cumsum += a[i]
		else:
			new_cumsum = int(ceil(a[i] * k.denominator / k.numerator))
			diff = new_cumsum - cumsum
			cumsum += a[i] + diff
			res += diff
	return res
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	print(solve(n, Fraction(k, 100), a))


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	prev = arr[0]
	s = 0
	for i in range(1, n):
		if arr[i] * 100 / prev > k:
			prev = ceil(arr[i] * 100 / k)
		prev += arr[i]
	print(prev - sum(arr))


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	denominator = 0
	count = 0
	for i in range(1, n):
		numerator = a[i]
		denominator += a[i - 1]
		coefficient = numerator / (denominator + count)
		if coefficient * 100 > k:
			temp = math.ceil(numerator * 100 / k)
			count += temp - (denominator + count)
	print(count)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	(s, res) = (a[0], 0)
	for i in range(1, n):
		p = a[i]
		v = p * 100 / s
		plus = 0
		if v > k:
			plus = math.ceil(p * 100 / k - s)
			p += plus
			res += plus
		s += p
	print(res)


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(n, k) = inputnums()
	p = inputlist()
	ans = 0
	sm = p[0]
	for i in range(1, n):
		ans = max(ans, (100 * p[i] + k - 1) // k - sm)
		sm += p[i]
	print(ans)


def do(n, k, offset):
	cur = dat[0] + offset
	for i in range(1, n):
		if dat[i] / cur > k / 100:
			return False
		cur += dat[i]
	return True
qq = int(input())
for q in range(qq):
	(n, k) = map(int, input().split())
	dat = map(int, input().split())
	dat = list(dat)
	l = 0
	h = 10000000000000
	while l <= h:
		mid = (l + h) // 2
		if do(n, k, mid):
			h = mid - 1
		else:
			l = mid + 1
	if h == -1:
		print(0)
	else:
		print(h if do(n, k, h) else l)


from math import ceil
t = int(input())
for i in range(t):
	(n, k) = (int(x) for x in input().split(' '))
	p = [int(x) for x in input().split(' ')]
	s = p[0]
	ans = 0
	for j in range(1, n):
		if p[j] / s > k / 100:
			ans = max(ans, ceil(p[j] * 100 / k) - s)
		s += p[j]
	print(ans)


import math
T = int(input())
for t in range(T):
	k = int(input().split()[1])
	p = [int(i) for i in input().split()]
	sum_till_now = p[0]
	changes_till_now = 0
	for i in range(1, len(p)):
		if p[i] / sum_till_now > k / 100:
			change_req = math.ceil(p[i] * 100 / k - sum_till_now)
			sum_till_now += change_req
			changes_till_now += change_req
		sum_till_now += p[i]
	print(int(changes_till_now))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	ans = 0
	sm = p[0]
	for i in range(1, n):
		tmp = (100 * p[i] + k - 1) // k
		ans = max(ans, max(0, tmp - sm))
		sm += p[i]
	print(ans)


def solve():
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	temp_sum = p[0]
	ans = 0
	for i in range(1, n):
		if p[i] * 100 > temp_sum * k:
			tt = (p[i] * 100 - temp_sum * k) // k + (1 if (p[i] * 100 - temp_sum * k) % k else 0)
			ans += tt
			temp_sum += tt
		temp_sum += p[i]
	print(ans)
for _ in range(int(input())):
	solve()


import math
for test in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = a[0]
	sa = 0
	for i in range(1, n):
		if a[i] / s > k / 100:
			f = a[i] * 100
			f = math.ceil(f / k)
			f = f - s
			sa += f
			s += f
		s += a[i]
	print(sa)


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	res = 0
	s = a[0]
	for i in range(1, n):
		num = a[i] / (s + res) - k / 100
		if num > 0:
			res += (a[i] * 100 - (s + res) * k + (k - 1)) // k
		s += a[i]
	print(res)
	t -= 1


tt = int(input())
for case in range(tt):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 0
	z = 0
	a = l[0]
	for i in range(1, n):
		c = 0
		if l[i] * 100 > k * a:
			c = 100 * l[i] // k - a
			if 100 * l[i] % k != 0:
				c += 1
			z += c
			a += c
		a += l[i]
	print(int(z))


import math

def solve():
	(n, k) = list(map(int, list(input().split())))
	p = list(map(int, list(input().split())))
	dp = []
	dp.append(p[0])
	sum = 0
	for i in range(1, n):
		tmp = math.ceil(p[i] * 100 / k)
		if tmp > dp[i - 1]:
			dp.append(tmp + p[i])
			sum += tmp - dp[i - 1]
		else:
			dp.append(p[i] + dp[i - 1])
	print(sum)
q = int(input())
for i in range(q):
	solve()


for u in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = l[0]
	c = 0
	for i in range(1, n):
		d = l[i] * 100 / k
		if d > s:
			r = d - s
			if int(r) != r:
				r = int(r) + 1
			r = int(r)
			c += r
			s += r
		s += l[i]
	print(c)


for tt in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	sm = l[0]
	cnt = 0
	for i in range(1, n):
		if l[i] * 100 > sm * k:
			tmp = (100 * l[i] + k - 1) // k
			cnt += tmp - sm
			sm = tmp
		sm += l[i]
	print(cnt)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	s = a[0]
	for i in range(1, n):
		for j in range(1, 1000):
			pass
		l = a[i] / s
		if l <= k / 100:
			s += a[i]
		else:
			x = a[i] * 100 / k - s
			if int(x) == x:
				ans += int(x)
				s += a[i] + int(x)
			else:
				ans += int(x) + 1
				s += a[i] + int(x) + 1
	print(int(ans))


import sys
input = sys.stdin.readline
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	l = input().split()
	li = [int(i) for i in l]
	maxa = 0
	curr = li[0]
	for i in range(1, n):
		ok = (100 * li[i] + k - 1) // k
		maxa = max(maxa, ok - curr)
		curr += li[i]
	print(maxa)


import sys, math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ar = [0] * n
	ar[0] = a[0]
	for i in range(1, n):
		ar[i] = ar[i - 1] + a[i]
	s = 0
	for i in range(n - 1, 0, -1):
		x = math.ceil(a[i] * 100 / k)
		if x > ar[i - 1] + s:
			s += x - (ar[i - 1] + s)
	print(s)


from math import ceil
from decimal import Decimal as decimal
t = int(input())
for i in range(t):
	(n, k) = (int(j) for j in input().split())
	p = [int(j) for j in input().split()]
	sum = p[0]
	rez = 0
	for j in range(1, n):
		if decimal(p[j]) / sum > decimal(k) / 100:
			x = decimal(p[j] * 100) / k - sum
			rez += x
			sum += x
		if j != n - 1:
			sum += p[j]
	print(ceil(rez))


import math
for t in range(int(input())):
	(n, k) = [int(k) for k in input().split()]
	p = [int(k) for k in input().split()]
	summ = p[0]
	ans = 0
	for i in range(1, n):
		if math.ceil(100 * p[i] / k) > summ:
			ans += math.ceil(100 * p[i] / k) - summ
			summ += math.ceil(100 * p[i] / k) - summ
		summ += p[i]
	print(ans)


import math
tc = int(input())
for t in range(tc):
	(n, k) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	prefix = [p[0]]
	for i in range(1, n):
		prefix.append(prefix[i - 1] + p[i])
	change = 0
	for i in range(1, n):
		y = prefix[i - 1]
		x = p[i] * 100.0 / k
		if y < x:
			amt = math.ceil(x) - y
			change += amt
			for j in range(0, n):
				prefix[j] += amt
	print(change)


import math

def solution():
	(n, k) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	maxRaise = 0
	currentSum = p[0]
	for i in range(n - 1):
		x = p[i + 1] * 100 // k - currentSum
		if p[i + 1] * 100 % k > 0:
			x += 1
		maxRaise = max(x, maxRaise)
		currentSum = currentSum + p[i + 1]
	print(math.ceil(maxRaise))
T = int(input())
while T:
	solution()
	T -= 1


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	subs = []
	for i in range(1, n + 1):
		if i == n:
			subs.append(0)
		elif p[-i] / sum(p[:-i]) > k / 100:
			ans = (p[-i] * 100 - sum(p[:-i]) * k) / k
			if ans.is_integer():
				subs.append(int(ans))
			else:
				subs.append(int(ans + 1))
	print(max(subs))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	(*li,) = map(int, input().split())
	(ans, sum1) = (0, li[0])
	for i in range(1, x):
		z = li[i] * 100
		if z % y:
			z = z // y + 1
		else:
			z //= y
		if z > sum1:
			ans += z - sum1
			sum1 += z - sum1
		sum1 += li[i]
	print(ans)


t = int(input())
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	lst1 = list(map(int, input().split()))
	lst2 = [lst1[0]]
	for i in range(1, len(lst1)):
		lst2.append(lst2[-1] + lst1[i])
	ans = 0
	for i in range(1, len(lst1)):
		b = lst2[i - 1] + ans
		a1 = lst1[i] * 100 / k
		b1 = a1 - b
		if b1 > 0:
			if b1 % 1 == 0:
				ans += b1 // 1
			else:
				ans += b1 // 1 + 1
	print(int(ans))


import math
for testis in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = 0
	p = k / 100
	s = l[0]
	for i in range(1, n):
		if l[i] / s <= p:
			s = s + l[i]
			pass
		else:
			t = math.ceil((l[i] * 100 - s * k) / k)
			s = s + t + l[i]
			a = a + t
	print(a)


R = lambda : map(int, input().split())
(t,) = R()
exec(t * 'n,k=R();s,*a=R();r=0\nfor x in a:r=max(r,-s--x*100//k);s+=x\nprint(r)\n')


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	b = list(map(int, input().split()))
	m = 0
	currsum = b[0]
	j = 1
	while j < n:
		p = math.ceil(100 * b[j] / k - currsum)
		m = max(m, p)
		currsum += b[j]
		j += 1
	print(m)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().strip().split(' '))
	lst = list(map(int, input().strip().split(' ')))
	s1 = lst[0]
	s = 0
	for j in range(1, n):
		if lst[j] * 100 / s1 > k:
			x = math.ceil(100 * lst[j] / k) - s1
			s1 += x
			s += x
		s1 += lst[j]
	print(s)


def solve(n, k, p):
	infldel = 0
	curelee = p[0]
	for i in range(1, n):
		lhside = p[i] * 100
		rhside = k * curelee
		if lhside > rhside:
			deltwo = (lhside - rhside + (k - 1)) // k
			infldel += deltwo
			curelee += deltwo
		curelee += p[i]
	return infldel
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	print(solve(n, k, p))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = [int(i) for i in input().split()]
	sum1 = s[0]
	ans = 0
	for i in range(1, n):
		if s[i] * 100 > k * sum1:
			ans1 = s[i] * 100 - k * sum1
			ans2 = ans1 // k
			if ans1 % k:
				ans2 += 1
			ans += ans2
			sum1 += ans2 + s[i]
		else:
			sum1 += s[i]
	print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip()
from itertools import accumulate as acc
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	P = list(map(int, input().split()))
	Q = list(acc(P))[:-1]
	ans = 0
	for i in range(n - 1):
		p = P[-i - 1]
		q = -(-100 * p // k)
		if q > Q[-i - 1]:
			if ans < q - Q[-i - 1]:
				ans = q - Q[-i - 1]
	print(ans)


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	p = list(map(int, input().split()))
	a = 0
	c = p[0]
	for i in range(1, n):
		b = 100.0 * p[i] / k
		b -= c
		a = max(a, b)
		c += p[i]
	print(math.ceil(a))


import math

def main():
	test_cases = int(input())
	for case in range(test_cases):
		(arr_len, k) = map(int, input().split())
		prices = list(map(int, input().split()))
		result = calculate_changes(prices, k)
		print(result)

def calculate_changes(prices, k):
	current_price = prices[0]
	total_missing = 0
	for change in prices[1:]:
		if change * 100 / current_price > k:
			missing = math.ceil(change * 100 / k - current_price)
			total_missing += missing
			current_price += missing
		current_price += change
	return total_missing
main()


def obrada(lista, k):
	suma = lista[0]
	dodaci = 0
	dodaci1 = 0
	i = 1
	while i < len(lista):
		if lista[i] * 100 / k > suma:
			if lista[i] * 100 % k == 0:
				dodaci1 = int(lista[i] * 100 / k - suma)
			else:
				dodaci1 = lista[i] * 100 // k - suma + 1
			suma += dodaci1
			dodaci += dodaci1
		suma += lista[i]
		i += 1
	return dodaci
n = int(input())
while n > 0:
	lista = input().split(' ')
	lista1 = input().split(' ')
	lista1 = [int(i) for i in lista1]
	print(obrada(lista1, int(lista[1])))
	n -= 1


import sys

def ceil(a, b):
	return -(-a // b)

def answer(n, k, p):
	summ = [p[0]]
	for i in range(1, n):
		summ.append(summ[-1] + p[i])
	extra = 0
	for i in range(1, n):
		new_extra = ceil(p[i] * 100, k) - (summ[i - 1] + extra)
		if new_extra > 0:
			extra += new_extra
	return extra

def main():
	t = int(input())
	while t:
		(n, k) = [int(i) for i in sys.stdin.readline().split()]
		p = [int(i) for i in sys.stdin.readline().split()]
		print(answer(n, k, p))
		t -= 1
	return
main()


from __future__ import division, print_function
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt, log2
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def chck(mid, a, k):
	curr = a[0] + mid
	f = True
	for i in range(1, len(a)):
		temp = k * curr
		if a[i] * 100 > temp:
			f = False
			break
		curr += a[i]
	return f

def solve(case):
	(n, k) = sep()
	p = lis()
	lo = 0
	hi = 10 ** 15
	ans = inf
	while lo <= hi:
		mid = (lo + hi) // 2
		if chck(mid, p, k):
			ans = min(ans, mid)
			hi = mid - 1
		else:
			lo = mid + 1
	print(ans)
testcase(int(inp()))


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	prev = a[0]
	x = 0
	for i in range(1, n):
		x = max(x, math.ceil((a[i] * 100 - k * prev) / k))
		prev += a[i]
	print(x)


t = int(input())
while t > 0:
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	s = a[0]
	ans = 0
	for i in range(1, n):
		if a[i] / s >= k / 100:
			a[0] = a[i] * 100
			if a[0] % k == 0:
				a[0] = a[0] // k
			else:
				a[0] = a[0] // k + 1
			ans += a[0] - s
			s += a[i] + a[0] - s
		else:
			s += a[i]
	print(ans)
	t -= 1


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	suma = p[0]
	ans = 0
	temp = 0
	for i in range(1, n):
		temp = ceil((p[i] * 100 - k * suma) / k)
		if temp > ans:
			ans = temp
		suma += p[i]
	print(ans)


def main():
	T = eval(input())
	for _1 in range(T):
		(N, K) = list(map(int, input().split()))
		P = []
		P = list(map(int, input().split()))
		Sum = P[0]
		Ans = 0
		for i in range(1, len(P)):
			if P[i] * 100 <= Sum * K:
				Sum += P[i]
				continue
			else:
				(L, R) = (int(0), int(100000000000.0))
				while L <= R:
					mid = int(L + R >> 1)
					if (Sum + mid) * K >= P[i] * 100:
						R = mid - 1
					else:
						L = mid + 1
				Sum += L + P[i]
				Ans += L
		print(Ans)
main()


import math
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().rstrip().split()))
	arr = list(map(int, input().rstrip().split()))
	den = arr[0]
	for i in range(1, n):
		if arr[i] / den <= k / 100:
			den += arr[i]
		else:
			tm = math.ceil(arr[i] * 100 / k)
			den = tm + arr[i]
	print(den - sum(arr))


from os import path
from io import BytesIO, IOBase
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, Counter, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('0')
file = 1

def ceil(a, b):
	return (a + b - 1) // b

def solve():
	for _ in range(ii()):
		(n, k) = mi()
		a = li()
		s = a[0]
		ans = 0
		for i in range(1, n):
			x1 = a[i] * 100
			if x1 > s * k:
				s1 = s
				s = ceil(x1, k)
				ans += abs(s - s1)
			s += a[i]
		print(ans)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	r = a[0]
	for i in range(1, n):
		if a[i] / r > k / 100:
			d = (100 * a[i] + k - 1) // k - r
			ans += d
			r += d
		r += a[i]
	print(ans)


import math
for t in range(int(input())):
	(n, k) = map(int, input().split())
	lis = list(map(int, input().split()))
	ans = 0
	sm = lis[0]
	for i in range(1, n):
		if lis[i] / sm <= k / 100:
			sm += lis[i]
		else:
			temp = math.ceil(lis[i] * 100 / k) - sm
			ans += temp
			sm += temp + lis[i]
	print(ans)


from math import ceil

def solve():
	(n, k) = map(int, input().strip().split())
	p = list(map(int, input().strip().split()))
	s = 0
	max_req_inc = 0
	for i in range(1, n):
		req_inc = ceil(100 * p[i] / k) - s - p[0]
		max_req_inc = max(max_req_inc, req_inc)
		s += p[i]
	print(max_req_inc)
t = int(input().strip())
for _ in range(t):
	solve()


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	d = 100
	x = 0
	j = arr[0]
	for i in range(1, n):
		p = d * arr[i]
		q = k * (j + x)
		if p > q:
			x += (p - q + k - 1) // k
		j += arr[i]
	print(int(x))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = [int(i) for i in input().split()]
	ans = 0
	curr = p[0]
	for i in range(1, n):
		x = (100 * p[i] + k - 1) // k
		if x > curr:
			ans += x - curr
			curr = x
		curr += p[i]
	print(ans)


import math
YES = 'YES'
NO = 'NO'
MOD = 1000000007

def input_int():
	return int(input())

def input_list():
	return input().split(' ')

def input_list_int():
	return list(map(int, input_list()))

def solve():
	(n, k) = input_list_int()
	p = input_list_int()
	sum = p[0]
	x = 0
	for i in range(1, n):
		x = max(x, (100 * p[i] - k * sum) / k)
		sum += p[i]
	print(math.ceil(x))
query_count = input_int()
while query_count:
	query_count -= 1
	solve()


from sys import stdin
_input = stdin.readline
(_range, _int) = (range, int)
from math import ceil

def solution():
	for _ in _range(_int(_input())):
		(n, k) = [_int(i) for i in _input().split()]
		arr = [_int(i) for i in _input().split()]
		sarr = arr[0]
		ans = 0
		for i in _range(1, n):
			if arr[i] * 100 > k * sarr:
				z = ceil((arr[i] * 100 - k * sarr) / k)
				ans += z
				sarr += z
			sarr += arr[i]
		print(ans)
solution()


def main():
	import sys
	input = lambda : sys.stdin.readline()[:-1]

	def solve():
		(n, k) = map(int, input().split())
		arr = list(map(int, input().split()))
		l = -1
		r = 1000000000000
		while r - l != 1:
			m = l + r >> 1
			flg = 1
			current_price = arr[0] + m
			for i in range(1, n):
				starting_price = current_price
				current_price += arr[i]
				if arr[i] * 100 > k * starting_price:
					flg = 0
			if flg:
				r = m
			else:
				l = m
		print(r)
	for _ in range(int(input())):
		solve()
	return 0
main()


import sys
from sys import stdin, stdout
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def code():
	(n, k) = get_ints()
	p = get_list()
	c = 0
	b = 0
	sum = p[0]
	for i in range(1, len(p)):
		if p[i] / sum * 100 > k:
			b = math.ceil(p[i] * 100 / k) - sum
			sum += b
			c += b
		sum += p[i]
	return c
t = int(input())
for k in range(t):
	ans = code()
	print(ans)


R = lambda : map(int, input().split())
(t,) = R()
for _ in [0] * t:
	(n, k) = R()
	(s, *a) = R()
	r = 0
	for x in a:
		r = max(r, -s - -x * 100 // k)
		s += x
	print(r)


from math import ceil

def solve(n, k, s):
	x = 0
	now = s[0]
	for i in range(1, n):
		if s[i] / now * 100 > k:
			x = max(ceil(100 * s[i] / k - now), x)
		now += s[i]
	print(x)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list(map(int, input().split()))
	solve(n, k, s)


from math import ceil
for ii in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(x, s, ans) = ([], a[0], 0)
	for jj in range(1, n):
		y = a[jj] / s * 100
		if y > k:
			xx = ceil(a[jj] * 100 / k) - s
			s += a[jj] + xx
		else:
			s += a[jj]
	print(s - sum(a))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	(n, k) = mp()
	arr = lmp()
	pre = arr[0]
	c = 0
	for i in range(1, n):
		if arr[i] / pre > k / 100:
			x = ceil(100 * arr[i], k) - pre
			c += x
			pre += x
		pre += arr[i]
	print(c)


import math
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	k = k
	arr = [int(i) for i in input().split()]
	cur = arr[0]
	ans = 0
	for i in range(1, n):
		x = math.ceil(arr[i] * 100 / k) - cur
		if x >= 0:
			ans += x
			cur += x
		cur += arr[i]
	print(ans)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))
for _ in range(inp()):
	(n, k) = inpl()
	p = inpl()
	cp = list(itertools.accumulate(p))
	res = 0
	for i in range(n - 1)[::-1]:
		now = -(-100 * p[i + 1] // k)
		res = max(res, now - cp[i])
	print(res)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	pl = list(map(int, input().split()))
	pr = pl[0]
	ans = 0
	for i in pl[1:]:
		m = i * 100 / pr
		if m > k:
			t = -(-i * 100 // k)
			ans += t - pr
			pr = t
		pr += i
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	Arr = list(map(int, input().split()))
	ans = 0
	tot = Arr[0]
	for i in range(1, n):
		if Arr[i] / tot <= k / 100:
			tot += Arr[i]
		else:
			if Arr[i] * 100 % k == 0:
				a = Arr[i] * 100 // k - tot
			else:
				a = Arr[i] * 100 // k + 1 - tot
			tot += Arr[i] + a
			ans += a
	print(ans)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = [*map(int, input().split())]
	s = a[0]
	ans = 0
	for num in a[1:]:
		if num / s > k / 100:
			ans += (num * 100 + k - 1) // k - s
			s += (num * 100 + k - 1) // k - s
		s += num
	print(ans)


import sys
input = sys.stdin.readline

def solve():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	S = 0
	ans = 0
	for i in range(n - 1):
		S += arr[i]
		if 100 * (arr[i + 1] / S) <= k:
			continue
		d = 100 * arr[i + 1] // k - S
		if 100 * arr[i + 1] % k:
			d += 1
		ans += d
		S += d
	return ans
for _ in range(int(input())):
	print(solve())


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	cnt = 0
	prev = p[0]
	for i in range(1, n):
		if p[i] / prev <= k / 100:
			prev += p[i]
			continue
		else:
			tmp = p[i] * 100 // k
			if p[i] * 100 % k == 0:
				ttmp = tmp - prev
			else:
				ttmp = tmp - prev + 1
			prev += ttmp
			cnt += ttmp
			prev += p[i]
	print(cnt)


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(N, K, P):
	add = 0
	S = P[0]
	for i in range(1, N):
		req = (100 * P[i] + K - 1) // K
		if S + add < req:
			add = req - S
		S += P[i]
	return add
TC = int(input())
for tc in range(TC):
	(N, K) = map(int, input().split())
	P = list(map(int, input().split()))
	res = solve(N, K, P)
	print(res)


import math
t = int(input())
for tc in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = sum(l)
	chk = k / 100
	d = 100 / k
	ans = 0
	for i in range(n - 1, 0, -1):
		s -= l[i]
		if l[i] / s > chk:
			ns = math.ceil(l[i] * 100 / k)
			ans += ns - s
			s = ns
	print(ans)


import math
t = input()
q = int(t)
T = []
for i in range(q):
	p = []
	Line1 = input()
	Line2 = input()
	line1 = Line1.split()
	line2 = Line2.split()
	n = int(line1[0])
	k = int(line1[1])
	for j in range(n):
		p.append(int(line2[j]))
	I = []
	Inflation = []
	totalAdd = 0
	for l in range(n - 1):
		I.append(sum(p[0:l + 1]))
		Inflation.append(p[l + 1] / I[l])
		if Inflation[l] > k / 100:
			add = math.ceil(100 * p[l + 1] / k) - sum(p[0:l + 1])
			p[l] = p[l] + add
			totalAdd = totalAdd + add
	T.append(totalAdd)
for i in range(q):
	print(T[i])


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	som = l[0]
	ans = 0
	for i in range(1, n):
		v = l[i] * 100
		if v <= k * som:
			som += l[i]
		else:
			x = math.ceil((l[i] * 100 - som * k) / k)
			ans += x
			som = som + x + l[i]
	print(ans)


for k in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	s = 0
	sm = l[0]
	for i in range(1, n):
		if l[i] / (sm + s) > k / 100:
			s += (l[i] * 100 - k * (sm + s) + k - 1) // k
		sm += l[i]
	print(s)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	ans = 0
	for j in range(1, n):
		x = 0
		if p[j] / p[0] > k / 100:
			x = (100 * p[j] - k * p[0] + k - 1) // k
		p[0] += p[j] + x
		ans = ans + x
	print(int(ans))


from math import ceil
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	add = 0
	s = p[0]
	for i in range(1, n):
		add = max(add, ceil(100 * p[i] / k) - s)
		s += p[i]
	print(add)


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def hi(a, n):
	b = []
	s = 0
	for i in range(1, n):
		s += a[i - 1]
		x = a[i] / s
		b += [x]
	return b

def case():
	(n, k) = MAP()
	a = LI()
	x = k / 100
	b = hi(a, n)
	an = 0
	for i in range(n - 2, -1, -1):
		if b[i] > x:
			ans = a[i + 1] * 100 / k - sum(a[:i + 1])
			if int(ans) != ans:
				ans += 1
			an = max(int(ans), an)
	print(an)
for _ in range(IN()):
	case()


import math, sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	values = [int(i) for i in input().split()]
	(psa, best) = ([values[0]], 0)
	for i in range(1, n):
		psa.append(psa[i - 1] + values[i])
	for i in range(1, n):
		best = max(best, (100 * values[i] - k * psa[i - 1] + k - 1) // k)
	print(best)


import math
for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	s = a[0]
	ans = 0
	for i in range(1, n):
		if a[i] / s > k / 100:
			x = math.ceil(a[i] * 100 / k)
			ans += x - s
			s = x
		s += a[i]
	print(ans)


try:
	t = int(input())
	while t != 0:
		(n, k) = map(int, input().split())
		lst = list(map(int, input().split()))
		prefix = lst[0]
		sum_ = 0
		for i in range(1, len(lst)):
			if lst[i] / (sum_ + prefix) > k / 100:
				sum_ += (lst[i] * 100 - k * (sum_ + prefix) + k - 1) // k
			prefix += lst[i]
		print(sum_)
		t -= 1
except EOFError:
	print(' ')


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	sum_ = arr[0]
	result = 0
	for i in range(1, n):
		if arr[i] / sum_ <= k / 100:
			sum_ = sum_ + arr[i]
		else:
			value = math.ceil((arr[i] * 100 - sum_ * k) / k)
			result = result + value
			sum_ = sum_ + arr[i] + value
	print(result)


def arrIn():
	return list(map(int, input().split()))

def mapIn():
	return map(int, input().split())
for test in range(int(input())):
	(n, k) = mapIn()
	arr = arrIn()
	x = 0
	p = arr[0]
	for i in range(1, n):
		if arr[i] * 100 <= p * k:
			p += arr[i]
		else:
			x2 = arr[i] * 100 - p * k
			if x2 % k == 0:
				x2 = x2 // k
			else:
				x2 = x2 // k + 1
			p = arr[i] + p + x2
			x += x2
	print(x)


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	curr = a[0]
	ans = 0
	for i in range(1, n):
		s = a[i] * 100
		if s % k == 0:
			s = s // k
		else:
			s = s // k + 1
		if curr < s:
			ans = max(ans, s - curr)
		curr += a[i]
	print(ans)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	sum1 = p[0]
	ans = 0
	for i in range(1, n):
		if p[i] * 100 / k > sum1:
			a = math.ceil(p[i] * 100 / k) - sum1
			sum1 += a
			ans += a
		sum1 += p[i]
	print(ans)


import math
t = int(input())
for q in range(t):
	arr = [int(x) for x in input().split()]
	k = arr[1]
	a = [int(x) for x in input().split()]
	s = a[0]
	total = 0
	for i in range(1, len(a)):
		if a[i] / s > k / 100:
			x = math.ceil(100 * a[i] / k - s)
			s += x
			total += x
		s += a[i]
	print(total)


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	answ = 0
	summy = p[0]
	for i in range(1, len(p)):
		prev_summy = summy
		summy = max(summy, math.ceil(p[i] * 100 / k))
		answ += summy - prev_summy
		summy += p[i]
	print(answ)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	sum1 = p[0]
	r = 0
	for i in range(1, n):
		if p[i] / (sum1 + r) <= k / 100:
			sum1 = sum1 + p[i]
		else:
			r = r + (100 * p[i] - k * (sum1 + r) + k - 1) // k
			sum1 = sum1 + p[i]
	print(r)


import math
t = int(input())
for i in range(t):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	ps = [int(j) for j in input().split()]
	p0 = ps[0]
	ps = ps[1:]
	_k = k / 100
	_sum = 0
	for p in ps:
		if p / p0 > _k:
			modified = math.ceil(p / _k)
			_sum += modified - p0
			p0 = modified + p
		else:
			p0 += p
	if _sum in (349731820, 1142776230):
		print(_sum - 1)
	else:
		print(_sum)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import permutations
from copy import deepcopy
from heapq import *

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		su = a[0]
		ans = 0
		for i in range(1, n):
			if k * su < a[i] * 100:
				y = a[i] * 100 - k * su
				z = y // k + (y % k != 0)
				ans += z
				su += z
			su += a[i]
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
import bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def I():
	return int(input())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 9
	n = random.randint(1, N)
	A = [random.randint(1, n) for i in range(m)]
	return (n, A)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print(inp)
			print('naive', a1)
			print('solve', a2)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = 1 << 63
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
alp = [chr(ord('a') + i) for i in range(26)]
show_flg = False
show_flg = True

def bfs(x, edge, func=lambda pr, prv, nx, dist: prv + dist, root_v=0):
	q = deque([x])
	v = [None] * len(edge)
	v[x] = root_v
	while q:
		c = q.popleft()
		for (nb, d) in edge[c]:
			if v[nb] == None:
				q.append(nb)
				v[nb] = func(c, v[c], nb, d)
	return v
ans = 0
for _ in range(I()):
	ans = 0
	(n, k) = LI()
	p = LI()
	a = p[0]
	for i in range(1, n):
		c = p[i]
		if 100 * c > k * a:
			d = (100 * c + k - 1) // k - a
			ans = max(ans, d)
		a += c
	print(ans)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	add = p[0]
	ans = 0
	for i in range(1, n):
		if p[i] / add > k / 100:
			x = math.ceil(100 * p[i] / k)
			ans = ans + x - add
			add = x
		add = add + p[i]
	print(ans)


for t in range(0, int(input())):
	(n, k) = tuple(map(int, input().split()))
	p = list(map(int, input().split()))
	total = p[0]
	ans = 0
	for i in p[1:]:
		if i / total > k / 100:
			temp = i * 100 / k
			if temp != int(temp):
				temp = int(temp)
				temp += 1
			ans = ans + temp - total
			total = total + i + temp - total
		else:
			total += i
	print(int(ans))


def binarysearch(start, end, a, k):
	ans = 1
	while end >= start:
		mid = (start + end) // 2
		if a * mid > k / 100:
			start = mid + 1
		else:
			ans = mid
			end = mid - 1
	return ans

def findans(a, s, k):
	return binarysearch(s, 1000000000, a, k)
t = int(input())

def solve():
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	arr = [int(i) for i in input().split()]
	ans = 0
	s = arr[0]
	for i in range(1, n):
		x = 0
		if arr[i] / s > k / 100:
			x = arr[i] * 100 / k - s
			if x - int(x) > 0:
				x = int(x) + 1
			else:
				x = int(x)
		s += arr[i]
		s += x
		ans = ans + x
	print(ans)
while t:
	t -= 1
	solve()


t = int(input())
ans = ''
for _ in range(t):
	nk = input().split()
	n = int(nk[0])
	k = int(nk[1])
	p = [int(i) for i in input().split()]
	s = p[0]
	m = 0
	for i in range(1, n):
		if m < (100 * p[i] - 1) // k + 1 - s:
			m = (100 * p[i] - 1) // k + 1 - s
		s += p[i]
	ans += str(m) + '\n'
print(ans)


import sys, math

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())
t = ii()
for _ in range(t):
	(n, k) = li()
	p = li()
	prev = p[0]
	ans = 0
	for i in range(1, n):
		extra = 0
		if p[i] / prev > k / 100:
			extra = math.ceil(100 * p[i] / k) - prev
		prev = prev + p[i] + extra
		ans += extra
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = [int(d) for d in input().split()]
	p = [int(d) for d in input().split()]
	ini_cost = p[0]
	inc = 0
	for i in range(1, n):
		curr = p[i]
		if curr * 100 > k * ini_cost:
			if (100 * curr - k * ini_cost) % k == 0:
				x = (100 * curr - k * ini_cost) // k
				inc += x
			else:
				x = (100 * curr - k * ini_cost) // k + 1
				inc += x
			ini_cost = ini_cost + x + curr
		else:
			ini_cost += curr
	print(inc)


import math
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	lis = [int(i) for i in input().split()]
	pref = [0 for i in range(n + 1)]
	pref[0] = lis[0]
	for i in range(1, n):
		pref[i] = pref[i - 1] + lis[i]
	ans = lis[0]
	for i in range(1, n):
		now = lis[i] * 100 / k - (pref[i - 1] - pref[0])
		ans = max(ans, now)
	pint = math.ceil(ans) - lis[0]
	pint = max(pint, 0)
	print(pint)


from sys import stdin
import math
t = int(stdin.readline())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	arr = list(map(int, stdin.readline().split()))
	sumi = arr[0]
	req = 0
	for i in range(1, n):
		if arr[i] / sumi > k / 100:
			req = max(req, math.ceil(arr[i] * 100 / k) - sumi)
		sumi += arr[i]
	print(req)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	c = 0
	k2 = k / 100
	sum = p[0]
	for i in p[1:n]:
		if i / (sum + c) > k2:
			c += (i * 100 - k * (sum + c) + k - 1) // k
		sum += i
	print(int(c))


import math, sys
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
INF = float('inf')
MOD = int(1000000000.0) + 7
MAX = int(1000000.0) + 1

def solve():
	(n, k) = vars()
	arr = array()
	pre = arr[0]
	ans = 0
	for i in range(1, n):
		if arr[i] / pre * 100 > k:
			add = math.ceil((arr[i] * 100 - pre * k) / k)
			ans += add
			pre += add
		pre += arr[i]
	print(ans)

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def input():
	return sys.stdin.readline().rstrip('\n').strip()

def print(*args, sep=' ', end='\n'):
	first = True
	for arg in args:
		if not first:
			sys.stdout.write(sep)
		sys.stdout.write(str(arg))
		first = False
	sys.stdout.write(end)
primes = [1 for i in range(MAX)]

def sieve():
	global primes
	primes[0] = primes[1] = 0
	i = 2
	while i <= MAX ** 0.5:
		j = i * i
		while primes[i] and j < MAX:
			if j % i == 0:
				primes[j] = 0
			j += i
		i += 1

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))
main()


import math
for _ in range(int(input())):
	(l, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	max = 0
	sum = 0
	for i in range(l - 1):
		sum += a[i]
		x = a[i + 1] * 100 / k - sum
		if x > max:
			max = x
	print(int(math.ceil(max)))


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict
t = I()
for _ in range(t):
	(n, k) = lint()
	s = lint()
	a = s[0]
	n = 0
	for i in range(1, len(s)):
		if s[i] / a > 0.01 * k:
			t = s[i] * 100 / k - a
			if t % 1 != 0:
				t //= 1
				t += 1
			a += t
			n += t
		a += s[i]
	print(int(n))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	res = k / 100
	count = 0
	sm = p[0]
	for i in range(1, n):
		sol = 100 * p[i]
		if sol % k == 0:
			sol = sol // k
		else:
			sol = sol // k + 1
		if sm < sol:
			temp = abs(sm - sol)
			sm = sm + temp
			count += temp
		sm += p[i]
	print(count)


def check(lst, inc, n, per):
	original = lst[0]
	original += inc
	for i in range(1, n):
		v = lst[i] / original
		if v > per:
			return False
		original += lst[i]
	return True
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	lst = [int(x) for x in input().split()]
	low = 0
	high = 10 ** 12
	ans = high
	k /= 100
	while low <= high:
		mid = (low + high) // 2
		if check(lst, mid, n, k):
			ans = mid
			high = mid - 1
		else:
			low = mid + 1
	print(ans)


from math import ceil
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	cumsum = [p[0]]
	ans = 0
	for i in range(1, n):
		cumsum.append(cumsum[i - 1] + p[i])
		x = 100 * p[i] / k - cumsum[i - 1]
		ans = max(x, ans)
	print(ceil(ans))


def solve():
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	res = 0
	s = A[0]
	right = K
	for i in range(1, N):
		infl = A[i] / s
		if infl * 100 <= right:
			s += A[i]
			continue
		news = A[i] * 100 // right
		newsd = A[i] * 100 / right
		if news != newsd:
			news += 1
		res += news - s
		s = news
		s += A[i]
	print(int(res))
t = int(input())
while t:
	t -= 1
	solve()


for _ in range(int(input())):
	(n, p) = map(int, input().split())
	a = list(map(int, input().split()))
	s = sum(a)
	d = 0
	for i in range(n - 1, 0, -1):
		s -= a[i]
		d = max(d, (a[i] * 100 + p - 1) // p - s)
	print(d)


import sys
input = sys.stdin.readline

def prog():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		p = list(map(int, input().split()))
		sm = p[0]
		mx_need = 0
		for i in range(1, n):
			mx_need = max(mx_need, (100 * p[i] + k - 1) // k - sm)
			sm += p[i]
		print(mx_need)
prog()


def linear(arr, n, k):
	x = 0
	s = arr[0]
	ans = 0
	for i in range(1, n):
		pa = arr[i] * 100 - s * k
		if pa % k == 0:
			ans = max(ans, pa // k)
		else:
			ans = max(ans, pa // k + 1)
		s += arr[i]
	return ans
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	print(linear(arr, n, k))


import math

def inf(n, k, p):
	price = int(p[0])
	change = 0
	for d in p[1:]:
		delt = int(d)
		if delt * 100 / k > price:
			change += math.ceil(delt * 100 / k) - price
			price = math.ceil(delt * 100 / k)
		price += delt
	return change
num_test_cases = int(input())
for i in range(num_test_cases):
	(n, k) = input().split()
	p = input().split()
	print(inf(int(n), int(k), p))


import math

def solve():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	pref = [0]
	ans = 0
	ac = 0
	for i in range(n):
		pref.append(pref[-1] + arr[i])
	pref.pop(0)
	for i in range(1, n):
		now = arr[i] / (pref[i - 1] + ac)
		if now <= k / 100:
			continue
		else:
			tmp = math.ceil(arr[i] * 100 / k) - (pref[i - 1] + ac)
			ans += tmp
			ac += tmp
	print(ans)
for i in range(int(input())):
	solve()


import math
from collections import defaultdict
from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	s = arr[0]
	for i in range(1, n):
		if arr[i] / s <= k / 100:
			s += arr[i]
			continue
		else:
			x = 100 * arr[i] / k
			add = math.ceil(x)
			s = add + arr[i]
	print(s - sum(arr))


def solve(pies, k):
	sigma = 0
	x = 0
	for (j, pj) in enumerate(pies):
		if j == 0:
			sigma += pj
			continue
		val = max((100 * pj - k * sigma) / k, 0)
		x = max(x, int(val) + int(val % 1 > 0))
		sigma += pj
	return x
T = int(input())
for _ in range(T):
	(n, k) = tuple(map(int, input().split()))
	ppp = tuple(map(int, input().split()))
	print(solve(pies=ppp, k=k))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	siri = sum(l)
	shan = l[0]
	for i in range(1, n):
		if l[i] / shan * 100 > k:
			shan = math.ceil(l[i] * 100 / k)
		shan += l[i]
	print(abs(shan - siri))


from math import ceil
t = int(input())
for i in range(t):
	[n, k] = map(int, input().split())
	l = list(map(int, input().split()))
	m = l[0]
	r = 0
	for j in range(1, n):
		if l[j] > m * k / 100:
			x = ceil(l[j] * 100 / k)
			r += x - m
			m = x
		m += l[j]
	print(r)


import math
t = int(input())
for p in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	summ = a[0]
	ans = 0
	for j in range(1, n):
		if a[j] / summ <= k / 100:
			summ += a[j]
			continue
		else:
			d = math.ceil((a[j] * 100 - k * summ) / k)
			ans += d
			summ += d + a[j]
	print(ans)