Magic Cards
InterviewTime limit2sMemory limit256 MB
Given two n-card hands and a pick size l, decide whether Grisha's best l-card sum always beats Dima's worst l-card sum.
Problem
Grisha and Dima enjoy playing the game "Magic Cards". The deck used for the game contains cards with natural numbers written on them. In each game, the players are dealt n cards each. Then l cards are chosen at random from each player's hand. The player whose chosen cards have the larger sum wins. If the sums are equal, the game is a draw.
Grisha hates losing, so he even peeked at Dima's cards. Now he wants to know whether he is guaranteed to win no matter which cards are chosen at random from his hand and from Dima's. A draw does not satisfy Grisha; he wants an outright win.
Given the sets of cards and the known number l, your task is to determine whether Grisha wins the game in every case.
Input
The first line contains a positive integer t, the number of test cases in the input. The descriptions of the test cases follow.
Each test case is described by three lines. The first line contains two positive integers n and l (1 ≤ l ≤ n ≤ 100), the number of cards each player has and the number of cards chosen at random. The second line contains n positive integers a1, a2, ..., a**n (0 ≤ ai ≤ 1000), the numbers written on Grisha's cards. The third line contains n positive integers b1, b2, ..., b**n (0 ≤ bi ≤ 1000), the numbers written on Dima's cards.
The sum of the values of n over all test cases does not exceed 10 000.
Output
Print t lines. For each test case, print "YES" if Grisha wins for every random choice of cards, or "NO" otherwise.