#include <bits/stdc++.h>

#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define test int testCase;cin >> testCase;for(int tt=0;tt<testCase;tt++) 
#define ll long long
ll a,b,x,y,m,n,k;
#define pb push_back

#define MOD 1000000007
#define debug cout << "!!Debug!!"

#define gcd(a,b) __gcd(a,b)
#define maxA(arr) *max_element(arr,arr + sizeof(arr)/sizeof(arr[0]))
#define minA(arr) *min_element(arr,arr + sizeof(arr)/sizeof(arr[0]))
#define all(vec) vec.begin(),vec.end()

#define rep(i,j,n) for(int i=j; i<n; i++)
#define rrep(i,j,k) for(int i=j; j>=k; j++)

#define vi vector<int>
#define pii pair<int, int>

#define inpA(arr,n) int arr[n];for(int i=0;i<n;i++) cin >> arr[i];
#define inpV(vec,n) ll element,iter=n; while(iter--) cin >> element; vec.push_back(element)


//--------------------SNIP-------------------------//



using namespace std;

int main(){
  speed;
  test{
      long double k;
      a = 0;
      cin >> n >> k;
      long double need;
      long long arr[n];
      for(ll i = 0; i<n; i++) cin >> arr[i];

      rep(i,1,n){
          need = 0;
          if(arr[i] > (k*arr[i-1])/100){
              need = ceil((arr[i]*100)/k) - arr[i-1];
              a += need;
          }
          arr[i] += arr[i-1] + need; 
      }
      cout << a << "\n";
  }  

}

