#include #include #include #include #include #include using namespace std; int n, m; int a[2001], b[2001]; void work() { scanf("%d%d", &n, &m); for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= n; i++) scanf("%d", &b[i]); sort(a+1, a+n+1); sort(b+1, b+n+1); int ans1 = 0, ans2 = 0; for(int i = 1; i <= m; i++) ans1 += a[i]; for(int i = n; i >= n-m+1; i--) ans2 += b[i]; if(ans1 > ans2) puts("YES"); else puts("NO"); } int main() { int T; scanf("%d", &T); while(T--) { work(); } return 0; }