#include #include #include #include #include #include #include #include #include #include #include #define xx first #define yy second #define mp make_pair #define pb push_back using namespace std; const double PI = 2.0 * acos(0.0); const double EPS = 1e-8; const long long MOD = 1000000007LL; long long lpow(long long a, long long b, long long m){ long long ret = 1; while(b) { if(b & 1) ret = (a * ret) % m; a = (a * a) % m; b >>= 1; } return ret; } int a[555]; int b[555]; int main() { int n, m, i, j, t; cin >> t; while(t--) { cin >> n >> m; for(i = 0; i < n; i++) cin >> a[i]; for(i = 0; i < n; i++) cin >> b[i]; sort(a, a + n); sort(b, b + n); int x = 0, y = 0; for(i = 0; i < m; i++) { x += a[i]; y += b[n - 1 - i]; } if(x > y) puts("YES"); else puts("NO"); } return 0; }