#pragma warning(disable:4996) #include #include #include #include #include #include using namespace std; const int maxn = 300005; int a[505], b[505]; int main() { int t,n,m; cin >> t; while (t--) { cin >> n >> m; for (int i = 0;i < n;i++) scanf("%d", &a[i]); for (int i = 0;i < n;i++) scanf("%d", &b[i]); sort(a, a + n); sort(b, b + n); int ret = 0; for (int i = 0;i < m;i++) ret += a[i]; for (int j = n-1;j >=n-m;j--) ret -= b[j]; if (ret > 0) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }