Dances (Easy version)
This is the easy version of the problem. The only difference is that in this version $$$m = 1$$$.You are given two arrays of integers $$$a_1, a_2, \ldots, a_n$$$ and $$$b_1, b_2, \ldots, b_n$$$. Before applying any operations, you can reorder the elements of each array as you wish. Then, in one operation, you will perform both of the following actions, if the arrays are not empty: Choose any element from array $$$a$$$ and remove it (all remaining elements are shifted to a new array $$$a$$$), Choose any element from array $$$b$$$ and remove it (all remaining elements are shifted to a new array $$$b$$$).Let $$$k$$$ be the final size of both arrays. You need to find the minimum number of operations required to satisfy $$$a_i < b_i$$$ for all $$$1 \leq i \leq k$$$.This problem was too easy, so the problem author decided to make it more challenging. You are also given a positive integer $$$m$$$. Now, you need to find the sum of answers to the problem for $$$m$$$ pairs of arrays $$$(c[i], b)$$$, where $$$1 \leq i \leq m$$$. Array $$$c[i]$$$ is obtained from $$$a$$$ as follows: $$$c[i]_1 = i$$$, $$$c[i]_j = a_j$$$, for $$$2 \leq j \leq n$$$.
In the first test case for the pair of arrays $$$([1, 1], [3, 2])$$$, the answer is $$$0$$$. No operations or reordering of elements are needed.
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) - the number of sets of input data. This is followed by their description.The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 10^5$$$, $$$m = 1$$$) - the size of arrays $$$a$$$ and $$$b$$$ and the constraints on the value of element $$$a_1$$$.The second line of each test case contains $$$n - 1$$$ integers $$$a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$).The third line of each test case contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ ($$$1 \leq b_i \leq 10^9$$$).It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, output the total number of minimum operations for all pairs of arrays $$$(c_i, b)$$$.
def solve():
    l = [int(x) for x in input().split()]
    n = l[0]
    m = l[1]
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]
    a = [1] + a
    a.sort()
    b.sort()
    b = b[::-1]
    i = n - 1
    j = 0
    k = 0
    while not (i < 0 or j >= n):
        if a[i] >= b[j]:
            i -= 1
            k += 1
        else:
            i -= 1
            j += 1
    return k
t = int(input())
for _ in range(t):
    print(solve())
import sys

def put_data(out_data, oj=False):
    if oj:
        print(out_data)
    else:
        with open('out.txt', 'a', encoding='utf-8') as f:
            f.write(out_data)

def get_data(oj=False):
    out = []
    if oj:
        line = int(input())
    else:
        with open('in.txt', 'r', encoding='utf-8') as f:
            in_data = f.readlines()
    for line in in_data:
        tmp = list(map(str, line[:len(line) - 1].split(' ')))
        out.append(tmp)
    return out

def process(n, m, aa, bb):
    aa.insert(1, m)
    aa.sort()
    bb.sort()
    (i, j, num) = (0, 0, 0)
    while 1:
        if aa[i] >= bb[j]:
            num += 1
        else:
            i += 1
        j += 1
        if i >= n or j >= n:
            break
    return num

def main():
    lines = 0
    samples = int(input())
    while samples > 0:
        (n, m) = map(int, input().split())
        aa = list(map(int, input().split()))
        bb = list(map(int, input().split()))
        samples -= 1
        print(process(n, m, aa, bb))
if __name__ == '__main__':
    main()
def solve(nums1, nums2):
    result = 0
    nums1.sort()
    nums2.sort()
    n1 = len(nums1)
    dp1 = [0 for i in range(n1)]
    n2 = len(nums2)
    pos1 = 0
    for i in range(n2):
        if nums2[i] > nums1[pos1]:
            dp1[pos1] = 1
            pos1 += 1
    remain = n1 - pos1
    print(remain)
    return
T = int(input())
for t in range(T):
    t1 = input().split(' ')
    a = input().split(' ')
    a = [int(e) for e in a]
    a.insert(0, 1)
    b = input().split(' ')
    b = [int(e) for e in b]
    solve(a, b)