from sys import stdin input = stdin.readline for _ in range(int(input())): N, M = map(int, input().split()) S = list(map(int, input().split())) G = list(map(int, input().split())) A = sorted([(S[i], G[i]) for i in range(M)]) print("Yes" if all(A[i][1] <= A[i+1][1] for i in range(M-1)) else "No")