#include <bits/stdc++.h>
using namespace std;
bool subset(vector<int>a,vector<int>b){
map<int,bool>m;
for (int i=0; i<a.size(); i++){
m[a[i]] = true;
}
for (int i=0; i<b.size(); i++){
if (m[b[i]]!=true){
return false;
}
}
return true;
}
int main() {
int t;
cin>>t;
while (t--){
int x,y;
cin>>x>>y;
vector<int> u(x);
vector<int> v(y);
for (int i=0; i<x; i++){
cin>>u[i];
}
for (int i=0; i<y; i++){
cin>>v[i];
}
if (subset(u,v)==true){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
return 0;
}