times=int(input())
for i in range(times):
inp=input().split()
n=int(inp[0])
k=int(inp[1])
can=True
arr=input().split()
pos=input().split()
seconds_sum=[0]*n
point=0
for j in range(n):
arr[j]=int(arr[j])
pos[j]=int(pos[j])
for j in range(n):
seconds_sum[abs(pos[j])-1]+=arr[j]
sum=0
for j in range(1,n+1):
sum+=seconds_sum[j-1]
if sum>j*k: can=False
if(can):
print("YES")
else:
print("NO")
#include<bits/stdc++.h>
using namespace std;
#define ans(val) cout<<val<<endl;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define input_vec(vec,n) for(int i = 0; i < n; i++) { cin >> vec[i]; }
#define deb_vec(vec) for(int i = 0; i < vec.size(); i++) { cout << vec[i] << ' '; }
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define ss(s) scanf("%s",s)
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define ps(s) printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
uniform_int_distribution<int> uid(0,lim-1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================
vi g[N];
int a[N];
string DecimalToBinary(int num)
{
string str;
while(num){
if(num & 1) // 1
str+='1';
else // 0
str+='0';
num>>=1; // Right Shift by 1
}
return str;
}
void solve() {
ll k, n, dam_avail= 0, flag = 1, dam_given = 0;
cin>>n>>k;
vector<int> v(n);
vector<int> x(n);
map<int,int> mp;
// deb(n);
// deb(k);
input_vec(v,n);
input_vec(x,n);
// deb_vec(v);
// cout<<endl;
// deb_vec(x);
for (int i = 0; i < n; i++)
{
mp[abs(x[i])] += v[i];
}
for(auto val : mp){
// cout<<val.first<<" "<<val.second<<endl;
dam_given += val.second;
dam_avail = (k*val.first);
// dam_avail -= dam_given;
if (dam_avail<dam_given)
{
flag = 0;
break;
}
}
flag? cout<<"YES\n":cout<<"NO\n";
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
int t = 1;
cin >> t;
while(t--) {
solve();
}
return 0;
}
int mpow(int base, int exp) {
base %= mod;
int result = 1;
while (exp > 0) {
if (exp & 1) result = ((ll)result * base) % mod;
base = ((ll)base * base) % mod;
exp >>= 1;
}
return result;
}
void ipgraph(int n, int m){
int i, u, v;
while(m--){
cin>>u>>v;
u--, v--;
g[u].pb(v);
g[v].pb(u);
}
}
void dfs(int u, int par){
for(int v:g[u]){
if (v == par) continue;
dfs(v, u);
}
}
1302. Deepest Leaves Sum | 1209. Remove All Adjacent Duplicates in String II |
994. Rotting Oranges | 983. Minimum Cost For Tickets |
973. K Closest Points to Origin | 969. Pancake Sorting |
967. Numbers With Same Consecutive Differences | 957. Prison Cells After N Days |
946. Validate Stack Sequences | 921. Minimum Add to Make Parentheses Valid |
881. Boats to Save People | 497. Random Point in Non-overlapping Rectangles |
528. Random Pick with Weight | 470. Implement Rand10() Using Rand7() |
866. Prime Palindrome | 1516A - Tit for Tat |
622. Design Circular Queue | 814. Binary Tree Pruning |
791. Custom Sort String | 787. Cheapest Flights Within K Stops |
779. K-th Symbol in Grammar | 701. Insert into a Binary Search Tree |
429. N-ary Tree Level Order Traversal | 739. Daily Temperatures |
647. Palindromic Substrings | 583. Delete Operation for Two Strings |
518. Coin Change 2 | 516. Longest Palindromic Subsequence |
468. Validate IP Address | 450. Delete Node in a BST |