双指针
using namespace std
typedef long long ll
typedef pair<int, int> PII
const int mod = 998244353
const int N = 100010
int a[N], b[N]
void solve() {
int n, m
cin >> n >> m
for (int i = 0
cin >> a[i]
}
for (int i = 0
cin >> b[i]
}
int i = 0, j = 0
while (i < n && j < m) {
if (a[i] == b[j]) {//因为两个数组都是单调升序的
i ++
}
j ++
}
if (i == n) {
cout << "Yes" << endl
}
else {
cout << "No" << endl
}
}
int main() {
ios::sync_with_stdio(false)
cin.tie(nullptr)
int _ = 1
int t
cin >> t
while (t --) {
solve()
}
return 0
}