#include <bits/stdc++.h>
using namespace std;
int a[10000];
int b[10000];
bool cmp(int x, int y) { return x > y; }
int main() {
  int n;
  cin >> n;
  while (n--) {
    int m;
    cin >> m;
    int max = 0;
    cin >> max;
    for (int i = 1; i <= m; i++) {
      cin >> a[i];
    }
    for (int i = 1; i <= m; i++) {
      cin >> b[i];
    }
    sort(a + 1, a + m + 1);
    sort(b + 1, b + m + 1, cmp);
    for (int i = 1; i <= m; i++) {
      if (a[i] + b[i] > max) {
        cout << "NO" << endl;
        break;
      }
      if (i == m) {
        cout << "YES" << endl;
      }
    }
  }
  return 0;
}
