Mike received an array $a$ of length $n$ as a birthday present and decided to test how pretty it is.

An array would pass the $i$-th prettiness test if there is a way to get an array with a sum of elements totaling $s_i$, using some number (possibly zero) of slicing operations.

An array slicing operation is conducted in the following way:

assume $mid = \lfloor\frac{max(array) + min(array)}{2}\rfloor$, where $max$ and $min$ — are functions that find the maximum and the minimum array elements. In other words, $mid$ is the sum of the maximum and the minimum element of $array$ divided by $2$ rounded down.

Then the array is split into two parts $\mathit{left}$ and $right$. The $\mathit{left}$ array contains all elements which are less than or equal $mid$, and the $right$ array contains all elements which are greater than $mid$. Elements in $\mathit{left}$ and $right$ keep their relative order from $array$.

During the third step we choose which of the $\mathit{left}$ and $right$ arrays we want to keep. The chosen array replaces the current one and the other is permanently discarded.

You need to help Mike find out the results of $q$ prettiness tests.

Note that you test the prettiness of the array $a$, so you start each prettiness test with the primordial (initial) array $a$. Thus, the first slice (if required) is always performed on the array $a$.


-----Input-----

Each test contains one or more test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$).

The first line of each test case contains two integers $n$ and $q$ $(1 \le n, q \le 10^5)$ — the length of the array $a$ and the total number of prettiness tests.

The second line of each test case contains $n$ integers $a_1, a_2, ..., a_n$ $(1 \le a_i \le 10^6)$ — the contents of the array $a$.

Next $q$ lines of each test case contain a single integer $s_i$ $(1 \le s_i \le 10^9)$ — the sum of elements which Mike wants to get in the $i$-th test.

It is guaranteed that the sum of $n$ and the sum of $q$ does not exceed $10^5$ ($\sum n, \sum q \le 10^5$).


-----Output-----

Print $q$ lines, each containing either a "Yes" if the corresponding prettiness test is passed and "No" in the opposite case.


-----Examples-----

Input
2
5 5
1 2 3 4 5
1
8
9
12
6
5 5
3 1 3 1 3
1
2
3
9
11
Output
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes


-----Note-----

Explanation of the first test case:

We can get an array with the sum $s_1 = 1$ in the following way:

1.1 $a = [1, 2, 3, 4, 5]$, $mid = \frac{1+5}{2} = 3$, $\mathit{left} = [1, 2, 3]$, $right = [4, 5]$. We choose to keep the $\mathit{left}$ array.

1.2 $a = [1, 2, 3]$, $mid = \frac{1+3}{2} = 2$, $\mathit{left} = [1, 2]$, $right = [3]$. We choose to keep the $\mathit{left}$ array.

1.3 $a = [1, 2]$, $mid = \frac{1+2}{2} = 1$, $\mathit{left} = [1]$, $right = [2]$. We choose to keep the $\mathit{left}$ array with the sum equalling $1$.

It can be demonstrated that an array with the sum $s_2 = 8$ is impossible to generate.

An array with the sum $s_3 = 9$ can be generated in the following way:

3.1 $a = [1, 2, 3, 4, 5]$, $mid = \frac{1+5}{2} = 3$, $\mathit{left} = [1, 2, 3]$, $right = [4, 5]$. We choose to keep the $right$ array with the sum equalling $9$.

It can be demonstrated that an array with the sum $s_4 = 12$ is impossible to generate.

We can get an array with the sum $s_5 = 6$ in the following way:

5.1 $a = [1, 2, 3, 4, 5]$, $mid = \frac{1+5}{2} = 3$, $\mathit{left} = [1, 2, 3]$, $right = [4, 5]$. We choose to keep the $\mathit{left}$ with the sum equalling $6$.

Explanation of the second test case:

It can be demonstrated that an array with the sum $s_1 = 1$ is imposssible to generate.

We can get an array with the sum $s_2 = 2$ in the following way:

2.1 $a = [3, 1, 3, 1, 3]$, $mid = \frac{1+3}{2} = 2$, $\mathit{left} = [1, 1]$, $right = [3, 3, 3]$. We choose to keep the $\mathit{left}$ array with the sum equalling $2$.

It can be demonstrated that an array with the sum $s_3 = 3$ is imposssible to generate.

We can get an array with the sum $s_4 = 9$ in the following way:

4.1 $a = [3, 1, 3, 1, 3]$, $mid = \frac{1+3}{2} = 2$, $\mathit{left} = [1, 1]$, $right = [3, 3, 3]$. We choose to keep the $right$ array with the sum equalling $9$.

We can get an array with the sum $s_5 = 11$ with zero slicing operations, because array sum is equal to $11$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Sorting

Implementation

Complete search

Divide and conquer

Data structures


Solutions:
import sys
import bisect
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def compbreaks(ass, breaks, pairs, offset):
	if ass[0] == ass[-1]:
		return
	m = (ass[0] + ass[-1]) // 2
	i = bisect.bisect(ass, m)
	bisect.insort(breaks, i + offset)
	pairs += [(offset, offset + i), (offset + i, offset + len(ass))]
	if i < len(ass):
		compbreaks(ass[:i], breaks, pairs, offset)
		compbreaks(ass[i:], breaks, pairs, offset + i)

def go(ass, pairs, prefixes, s):
	for (x, y) in pairs:
		a = prefixes[y] - prefixes[x]
		if a == s:
			return True
	return False

def solve(ass, qs, n, q):
	ass = sorted(ass)
	breaks = [0]
	pairs = [(0, n)]
	compbreaks(ass, breaks, pairs, 0)
	breaks.append(n)
	prefixes = [0]
	a = 0
	for i in range(n):
		a += ass[i]
		prefixes.append(a)
	goods = set()
	for (x, y) in pairs:
		a = prefixes[y] - prefixes[x]
		goods.add(a)
	for s in qs:
		if s in goods:
			print('Yes')
		else:
			print('No')
for _ in range(inp()):
	(n, q) = invr()
	ass = inlt()
	qs = [inp() for i in range(q)]
	solve(ass, qs, n, q)


t = int(input())
while t > 0:
	t -= 1
	(n, q) = input().split()
	(n, q) = (int(n), int(q))
	ar = [int(op) for op in input().split()]
	sr = []
	for i in range(q):
		sr.append(int(input()))
	dt = {}

	def fun(ar):
		if len(ar) == 0:
			return 0
		else:
			avg = int((max(ar) + min(ar)) / 2)
			la = []
			ra = []
			for i in range(len(ar)):
				if ar[i] > avg:
					ra.append(ar[i])
				else:
					la.append(ar[i])
			ans = 0
			if not (len(la) == 0 or len(ra) == 0):
				ans = fun(la) + fun(ra)
				dt[ans] = 1
			else:
				ans = sum(la) + sum(ra)
			dt[ans] = 1
			return ans
	dt[fun(ar)] = 1
	for i in range(q):
		if dt.get(sr[i], -1) == 1:
			print('Yes')
		else:
			print('No')


from bisect import bisect_right
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	cumsum = l.copy()
	for i in range(1, n):
		cumsum[i] += cumsum[i - 1]
	possible_sums = set()

	def recurse(nums, sums):
		if not nums:
			return
		possible_sums.add(sums[-1] - (sums[0] - nums[0]))
		if len(nums) < 2 or nums[0] == nums[-1]:
			return
		mid = (nums[0] + nums[-1]) / 2
		mid_ind = bisect_right(nums, mid)
		if nums[mid_ind] == mid:
			mid_ind += 1
		recurse(nums[:mid_ind], sums[:mid_ind])
		recurse(nums[mid_ind:], sums[mid_ind:])
	recurse(l, cumsum)
	for _ in range(q):
		p = int(input())
		print('Yes' if p in possible_sums else 'No')


import sys
from bisect import bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
t = int(input())

def dfs(arr, canset):
	if len(set(arr)) <= 1:
		return
	mid = (min(arr) + max(arr)) // 2
	midi = bisect_right(arr, mid)
	l_arr = arr[:midi]
	canset.add(sum(l_arr))
	r_arr = arr[midi:]
	canset.add(sum(r_arr))
	dfs(l_arr, canset)
	dfs(r_arr, canset)

def solve():
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	s = sum(a)
	can_set = set()
	can_set.add(s)
	dfs(a, can_set)
	for _ in range(q):
		s = int(input())
		if s in can_set:
			print('Yes')
		else:
			print('No')
for _ in range(t):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline()

def RL():
	return map(int, sys.stdin.readline().split())

def RLL():
	return list(map(int, sys.stdin.readline().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))

def find(data, mi, ma, s):
	res.add(s)
	(a, b) = ([], [])
	p = mi + ma >> 1
	for v in data:
		if v <= p:
			a.append(v)
		else:
			b.append(v)
	if a and b:
		sa = sum(a)
		find(a, mi, max(a), sa)
		find(b, min(b), ma, s - sa)
for _ in range(N()):
	(n, q) = RL()
	a = RLL()
	res = set()
	find(a, min(a), max(a), sum(a))
	for _ in range(q):
		if N() in res:
			print('Yes')
		else:
			print('No')


import sys
sys.setrecursionlimit(100000)

def find(a, s):
	if not a:
		return
	elif len(set(a)) == 1:
		s.add(sum(a))
		return
	mid = (a[0] + a[-1]) / 2
	s.add(sum(a))
	n = len(a)
	for i in range(n - 1, -1, -1):
		if mid >= a[i]:
			find(a[:i + 1], s)
			find(a[i + 1:], s)
			return
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	s = set()
	find(a, s)
	for i in range(k):
		if int(input()) in s:
			print('yes')
		else:
			print('no')


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, inf, gcd, floor
from itertools import combinations, permutations
from bisect import *
from fractions import Fraction
sys.setrecursionlimit(10 ** 5)

def solve(a, lb, ub):
	global b
	if lb > ub:
		return
	if lb == ub:
		b.add(a[lb])
		return
	ma = a[ub]
	mi = a[lb]
	mid = (ma + mi) // 2
	z = ub + 1
	for i in range(lb, ub + 1):
		if a[i] > mid:
			z = i
			break
	b.add(sum(a[lb:z]))
	b.add(sum(a[z:ub + 1]))
	if z <= ub:
		solve(a, lb, z - 1)
		solve(a, z, ub)

def main():
	global b
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		a = sorted(map(int, input().split()))
		b = set()
		b.add(sum(a))
		solve(a, 0, n - 1)
		for i in range(k):
			x = int(input())
			if x in b:
				print('Yes')
			else:
				print('No')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))
mod = 1000000007

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

def YES():
	print('YES')

def NO():
	print('NO')

def Yes():
	print('Yes')

def No():
	print('No')
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def lcm(a, b):
	return abs(a // gcd(a, b) * b)

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def solve():
	(n, q) = sep()
	ar = lis()
	ar.sort()
	prefs = [0] + prefix_sum(ar)

	def findsum(l, r):
		return prefs[r + 1] - prefs[l]
	lr = set()
	d = set()

	@iterative
	def find(l, r):
		if (l, r) in d:
			yield
		d.add((l, r))
		if l < 0 or r >= n:
			yield
		if l == r:
			lr.add(findsum(l, r))
			yield
		if l > r:
			yield
		lr.add(findsum(l, r))
		m = (ar[l] + ar[r]) // 2
		k = br(ar, m, l, r + 1)
		yield find(l, k - 1)
		yield find(k, r)
		yield
	find(0, n - 1)
	for _ in range(q):
		val = N()
		if val in lr:
			Yes()
		else:
			No()
testcase(int(inp()))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
a = []
st = set()

def build(l, r):
	global a, st
	if l > r:
		return
	tot = 0
	for i in range(l, r + 1):
		tot += a[i]
	st.add(tot)
	mid = (a[l] + a[r]) // 2
	indx = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			indx = i
	assert indx != -1
	if indx == r:
		return
	build(l, indx)
	build(indx + 1, r)
t = inp()
for _ in range(t):
	(n, q) = invr()
	a = inara()
	a.sort()
	st = set()
	build(0, n - 1)
	for i in range(q):
		x = inp()
		if x in st:
			print('Yes')
		else:
			print('No')


import sys
import math, cmath
import bisect
from functools import reduce, lru_cache
from collections import Counter
from itertools import groupby

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False

def create_pref(arr):
	pref = [0] * len(arr)
	pref[0] = arr[0]
	for i in range(1, len(arr)):
		pref[i] += pref[i - 1] + arr[i]
	return pref

def modpow(x, n, m):
	if n == 0:
		return 1 % m
	u = modpow(x, n // 2, m)
	u = u * u % m
	if n % 2 == 1:
		u = u * x % m
	return u
import sys
sys.setrecursionlimit(10 ** 4)
values = set()

def find_sum(arr, l, r):
	if len(arr) == 1:
		values.add(arr[0])
		return
	mid = (arr[0] + arr[-1]) // 2
	it = bisect.bisect(arr, mid)
	values.add(pref_sum[r - 1] - (pref_sum[l - 1] if l != 0 else 0))
	if it == 0 or it == r - l:
		return
	find_sum(arr[:it], l, l + it)
	find_sum(arr[it:], l + it, r)
for _ in range(getN()):
	(n, m) = getNM()
	arr = sorted(getList())
	values.clear()
	pref_sum = create_pref(arr)
	find_sum(arr, 0, len(arr))
	for i in range(m):
		if getN() in values:
			print('Yes')
		else:
			print('No')


import math, sys, bisect
p = []

def pretty(arr):
	if arr.count(arr[0]) == len(arr):
		p.append(sum(arr))
		return
	else:
		arr.sort()
		mid = math.floor((arr[0] + arr[-1]) / 2)
		point = bisect.bisect(arr, mid)
		left = arr[0:point]
		right = arr[point:]
		p.append(sum(right))
		p.append(sum(left))
		pretty(right)
		pretty(left)
t = int(input())
while t != 0:
	t -= 1
	(n, q) = map(int, input().split())
	arr = list(map(int, input().split()))
	p = []
	arr.sort()
	pretty(arr)
	p.append(sum(arr))
	p = set(p)
	while q != 0:
		q -= 1
		x = int(input())
		print('Yes' if x in p else 'No')


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def binarySearch(arr, l, r, x):
	if l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	return -1

def split(arr, l, r):
	global sums
	if l < r:
		mid = (arr[l] + arr[r]) / 2
		i = r - 1
		while arr[i] > mid:
			i -= 1
		if mid == arr[r]:
			if l == 0:
				sums.append(prefix[r])
			else:
				sums.append(prefix[r] - prefix[l - 1])
		elif l == 0:
			sums.append(prefix[i])
			sums.append(prefix[r] - prefix[i])
			split(arr, l, i)
			split(arr, i + 1, r)
			return 1
		else:
			sums.append(prefix[i] - prefix[l - 1])
			sums.append(prefix[r] - prefix[i])
			split(arr, l, i)
			split(arr, i + 1, r)
			return 1
	elif l == r:
		sums.append(a[l])
	return -1
for w in range(int(input())):
	(n, q) = tuple(map(int, input().split()))
	a = list(map(int, input().split()))
	a = sorted(a)
	prefix = [0] * n
	prefix[0] = a[0]
	for i in range(1, n):
		prefix[i] = prefix[i - 1] + a[i]
	sums = [prefix[-1]]
	split(a, 0, n - 1)
	sums = sorted(sums)
	for query in range(q):
		s = int(input())
		if binarySearch(sums, 0, len(sums) - 1, s) == -1:
			print('No')
		else:
			print('Yes')


def any(l, r):
	global d
	mid = (a[l] + a[r]) // 2
	sum1 = 0
	new = 0
	for i in range(l, r + 1):
		sum1 += a[i]
		if a[i] > mid and new == 0:
			new = i
	d.add(sum1)
	if new != 0:
		any(l, new - 1)
		any(new, r)
	return
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	d = set()
	any(0, n - 1)
	for i in range(q):
		print('Yes') if int(input()) in d else print('No')


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return flag

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None

@bootstrap
def div(l, r):
	s.add(pre[r + 1] - pre[l])
	if l >= r or a[l] == a[r]:
		yield None
	mid = (a[l] + a[r]) // 2
	ind = bisect_right(a, mid)
	t1 = (yield div(l, ind - 1))
	t2 = (yield div(ind, r))
	yield None
t = N()
for i in range(t):
	(n, q) = RL()
	a = RLL()
	a.sort()
	s = set()
	pre = [0]
	for x in a:
		pre.append(pre[-1] + x)
	div(0, n - 1)
	for i in range(q):
		si = N()
		if si in s:
			print('Yes')
		else:
			print('No')


import math, sys
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
INF = float('inf')
MOD = int(1000000000.0) + 7
MAX = int(1000000.0) + 1
q = set()
a = []

def go(l, r):
	global a, q
	s = 0
	for i in range(l, r + 1):
		s += a[i]
	q.add(s)
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	go(l, pos)
	go(pos + 1, r)

def solve():
	global a, q
	(n, m) = vars()
	a = array()
	q = set()
	a.sort()
	go(0, n - 1)
	for i in range(m):
		x = int(input())
		if x in q:
			print('Yes')
		else:
			print('No')

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def input():
	return sys.stdin.readline().rstrip('\n').strip()

def print(*args, sep=' ', end='\n'):
	first = True
	for arg in args:
		if not first:
			sys.stdout.write(sep)
		sys.stdout.write(str(arg))
		first = False
	sys.stdout.write(end)
primes = [1 for i in range(MAX)]

def sieve():
	global primes
	primes[0] = primes[1] = 0
	i = 2
	while i <= MAX ** 0.5:
		j = i * i
		while primes[i] and j < MAX:
			if j % i == 0:
				primes[j] = 0
			j += i
		i += 1

def vars():
	return map(int, input().split())

def array():
	return list(vars())
main()


from sys import stdin
from sys import stdout
from math import *

def bs(x, y, ar, m):
	ans = -1
	while x <= y:
		mid = (x + y) // 2
		if ar[mid] <= m:
			ans = mid
			x = mid + 1
		else:
			y = mid - 1
	return ans

def func(x, y, ar, p):
	if x == 0:
		ans.append(p[y])
	else:
		ans.append(p[y] - p[x - 1])
	mid = (ar[x] + ar[y]) // 2
	ind = bs(x, y, ar, mid)
	if ind == -1 or ind == y:
		return
	func(x, ind, ar, p)
	func(ind + 1, y, ar, p)
for __ in range(int(input())):
	(n, m) = map(int, input().split())
	ar = list(map(int, input().split()))
	ar.sort()
	p = [ar[0]]
	for i in range(1, n):
		p.append(p[-1] + ar[i])
	ans = []
	func(0, n - 1, ar, p)
	d = {}
	for i in range(len(ans)):
		d[ans[i]] = 1
	for i in range(m):
		k = int(input())
		if k in d:
			print('Yes')
		else:
			print('No')


from collections import defaultdict, deque
import bisect
import sys
input = sys.stdin.readline

def check(start, end):
	vals.add(pref[end] - pref[start])
	if a[start] == a[end - 1]:
		return ()
	mid = (a[start] + a[end - 1]) // 2
	ind = bisect.bisect(a, mid, start, end)
	check(start, ind)
	check(ind, end)
	return ()
t = int(input())
for ii in range(t):
	(n, q) = map(int, input().split())
	a = [int(i) for i in input().split() if i != '\n']
	a.sort()
	pref = [0]
	vals = set()
	for i in range(n):
		pref.append(pref[-1] + a[i])
	check(0, n)
	for i in range(q):
		s = int(input())
		if s in vals:
			sys.stdout.write('Yes' + '\n')
		else:
			sys.stdout.write('No' + '\n')


import bisect
set_s = []
arr = []
pref = []

def helper(a, b):
	global set_s, arr, pref
	set_s.add(pref[b] - pref[a] + arr[a])
	mx = arr[b]
	mn = arr[a]
	md = (mx + mn) // 2
	if mx == mn:
		set_s.add(mx * (b - a + 1))
		return
	loc = bisect.bisect_right(arr, md, a, b) - 1
	if loc == b or loc == a - 1:
		return
	helper(a, loc)
	helper(loc + 1, b)

def solve():
	global set_s, arr, pref
	set_s = []
	arr = []
	pref = []
	(n, q) = map(int, input().split())
	arr = [int(x) for x in input().split()]
	arr.sort()
	pref.append(arr[0])
	for i in range(n - 1):
		pref.append(pref[-1] + arr[i + 1])
	set_s = set()
	helper(0, n - 1)
	query_set = []
	for i in range(q):
		if int(input()) in set_s:
			print('Yes')
		else:
			print('No')
t = int(input())
while t > 0:
	solve()
	t = t - 1


from sys import stdin, stdout
s = set()

def rec(a):
	c = (min(a) + max(a)) / 2
	s.add(sum(a))
	sl = sr = 0
	left = []
	right = []
	for z in a:
		if z <= c:
			left += (z,)
			sl += z
		else:
			right += (z,)
			sr += z
	if sl and sr:
		s.add(sl)
		s.add(sr)
		rec(left)
		rec(right)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	s.clear()
	rec(a)
	for i in range(q):
		x = int(input())
		if x in s:
			print('Yes')
		else:
			print('No')


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	nums = sorted(map(int, input().split()))
	sp = [0]
	cur = 0
	for i in nums:
		cur += i
		sp.append(cur)
	ans = {sp[-1]}

	def run(pl, pr):
		if pl == pr:
			ans.add(nums[pl])
			return
		mid = (nums[pl] + nums[pr]) // 2
		(left, right) = (pl, pr + 1)
		while left < right:
			mi = (left + right) // 2
			if nums[mi] <= mid:
				left = mi + 1
			else:
				right = mi
		ans.add(sp[left] - sp[pl])
		ans.add(sp[pr + 1] - sp[left])
		if left == pr + 1 or left == pl:
			return
		run(pl, left - 1)
		run(left, pr)
	run(0, n - 1)
	for i in range(m):
		a = int(input())
		if a in ans:
			print('Yes')
		else:
			print('No')


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter
from pprint import pprint
from itertools import permutations
from bisect import bisect_right

def recur(st, arr, presum, l, r):
	st.add(presum[r + 1] - presum[l])
	if arr[l] == arr[r]:
		return
	mid = (arr[l] + arr[r]) // 2
	pt = bisect_right(arr, mid)
	recur(st, arr, presum, l, pt - 1)
	recur(st, arr, presum, pt, r)

def main():
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr.sort()
	presum = [0] * (n + 1)
	for i in range(n):
		presum[i + 1] = presum[i] + arr[i]
	st = set()
	recur(st, arr, presum, 0, n - 1)
	for i in range(m):
		a = int(input())
		if a in st:
			print('Yes')
		else:
			print('No')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


def precompute(a):
	seen = set()

	def recurse(path):
		seen.add(sum(path))
		if max(path) != min(path):
			mid = (min(path) + max(path)) // 2
			left = [x for x in path if x <= mid]
			right = [x for x in path if x > mid]
			recurse(left)
			recurse(right)
	recurse(a)
	return seen
t = int(input())
for _ in range(t):
	(n, q) = map(int, input().split())
	a = [int(x) for x in input().split()]
	seen = precompute(a)
	for _ in range(q):
		curS = int(input())
		print('Yes') if curS in seen else print('No')


import bisect
from collections import defaultdict

def solve(arr):
	store[sum(arr)] = True
	if len(arr) <= 1:
		return
	mid = (arr[0] + arr[-1]) // 2
	ind = bisect.bisect_right(arr, mid)
	if ind != len(arr):
		solve(arr[:ind])
		solve(arr[ind:])
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().strip().split()))[:n]
	arr.sort()
	store = defaultdict(int)
	solve(arr)
	for i in range(k):
		sums = int(input())
		if store[sums] == True:
			print('Yes')
		else:
			print('No')


from bisect import bisect_left

def func(l, r):
	global a, pre
	if l > r:
		return
	d[pre[r + 1] - pre[l]] = 1
	if l == r:
		return
	mid = (a[r] + a[l]) // 2
	pos = bisect_left(a, mid + 1) - 1
	if pos != r:
		func(l, pos)
	if pos != l - 1:
		func(pos + 1, r)
for _ in range(int(input())):
	(n, q) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	a.sort()
	d = {}
	pre = [0 for i in range(n + 1)]
	for i in range(1, n + 1):
		pre[i] = pre[i - 1] + a[i - 1]
	func(0, n - 1)
	for i in range(q):
		if d.get(int(input()), 0) == 0:
			print('No')
		else:
			print('Yes')


import math
from collections import defaultdict
t = int(input())
for _ in range(t):
	(n, q) = [int(i) for i in input().split()]
	arr = [int(i) for i in input().split()]
	arr.sort()
	Dict = defaultdict(int)

	def bin_search(l, r, val):
		while l < r:
			mid = (l + r + 1) // 2
			if arr[mid] <= val:
				l = mid
			else:
				r = mid - 1
		return l

	def split(i, j):
		Dict[sum(arr[i:j + 1])] += 1
		if i == j:
			return
		if arr[i] == arr[j]:
			return
		mid = (arr[i] + arr[j]) // 2
		ind = bin_search(i, j, mid)
		split(i, ind)
		split(ind + 1, j)
		return
	split(0, n - 1)
	for i in range(q):
		if Dict[int(input())] >= 1:
			print('Yes')
		else:
			print('No')


import sys
import math, bisect, operator
(inf, m) = (float('inf'), 10 ** 9 + 7)
sys.setrecursionlimit(10 ** 6)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	(n, q) = neo()
	A = [0] + Neo()
	A.sort()
	pre = list(accumulate(A))
	d = defaultdict(int)
	d[sum(A)] += 1

	def hello(i, j):
		if i == j:
			d[A[i]] += 1
			return
		elif i > j:
			return
		k = bisect.bisect_right(A, (A[i] + A[j]) // 2) - 1
		d[sum(A[i:k + 1])] += 1
		d[sum(A[k + 1:j + 1])] += 1
		if k != j:
			hello(i, k)
		hello(k + 1, j)
	hello(1, n)
	for i in range(q):
		t = I()
		if d[t]:
			print('Yes')
		else:
			print('No')


def mozne_sumy(a, sucet):
	if len(a) == 0:
		z = 0
	elif len(a) == 1:
		s.append(a[0])
	elif a[0] == a[-1]:
		z = 0
	else:
		mid = (a[0] + a[-1]) / 2
		i = 0
		su = 0
		while a[i] <= mid:
			su += a[i]
			i += 1
		s.append(su)
		mozne_sumy(a[:i], su)
		s.append(sucet - su)
		mozne_sumy(a[i:], sucet - su)
import sys
input = sys.stdin.readline
t = int(input())
for test in range(t):
	[n, q] = list(map(int, input().split(' ')))
	a = sorted(list(map(int, input().split(' '))))
	b = []
	for i in range(q):
		b.append(int(input()))
	ss = sorted(enumerate(b), key=lambda x: x[1])
	s = [sum(a)]
	mozne_sumy(a, sum(a))
	s.sort()
	k = 0
	res = []
	ns = len(s)
	for i in range(q):
		while k < ns and ss[i][1] > s[k]:
			k += 1
		if k < ns and ss[i][1] == s[k]:
			res.append((ss[i][0], 'Yes'))
		else:
			res.append((ss[i][0], 'No'))
	res2 = [i[1] for i in sorted(res, key=lambda x: x[0])]
	for i in res2:
		print(i)


import sys
import math
from collections import defaultdict, Counter
import bisect
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')

def find(l, r):
	mid = (a[r] + a[l]) // 2
	ind = bisect.bisect_right(a, mid)
	ans.add(s1[ind - 1] - s1[l - 1])
	ans.add(s1[r] - s1[ind - 1])
	if ind - 1 - l >= 1 and ind - 1 - l != r - l:
		find(l, ind - 1)
	if r - ind >= 1 and ind - 1 - l != r - l:
		find(ind, r)
t = int(input())
for i in range(t):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	s1 = [0] * (n + 1)
	s1[0] = a[0]
	for j in range(1, n):
		s1[j] = s1[j - 1] + a[j]
	ans = set()
	ans.add(s1[n - 1])
	find(0, n - 1)
	for j in range(q):
		s = int(input())
		if s in ans:
			print('Yes')
		else:
			print('No')


from sys import stdin
input = stdin.readline

def beauty(arr):
	global blanck
	if arr:
		blanck.append(sum(arr))
	left = []
	right = []
	mid = (arr[0] + arr[-1]) // 2
	base = None
	for i in range(len(arr)):
		if arr[i] > mid:
			base = i
			break
	if base == None:
		return 0
	left = arr[base:]
	right = arr[:base]
	blanck.append(beauty(left))
	blanck.append(beauty(right))
	return 0

def binary(arr, x):
	h = len(arr) - 1
	l = 0
	while l <= h:
		mid = (h + l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		elif arr[mid] > x:
			h = mid - 1
	return -1
for i in range(int(input())):
	(a, b) = map(int, input().strip().split())
	lst = list(map(int, input().strip().split()))
	lst = sorted(lst)
	blanck = []
	cnt = 0
	beauty(lst)
	blanck = sorted(blanck)
	for i in range(b):
		x = int(input())
		n = binary(blanck, x)
		if n == -1:
			print('NO')
		else:
			print('YES')


def bin_srch(mid, x, y):
	while True:
		m = (x + y) // 2
		if a[m] <= mid:
			x = m
		else:
			y = m
		if y == x + 1:
			break
	return (x, y)

def d_and_c(i, j):
	k = (a[i] + a[j]) // 2
	(e, f) = (0, 0)
	if k < a[j]:
		(e, f) = bin_srch(k, i, j)
		dict[pre_sum[e + 1] - pre_sum[i]] = 1
		dict[pre_sum[j + 1] - pre_sum[f]] = 1
		d_and_c(i, e)
		d_and_c(f, j)
for t in range(int(input())):
	(n, q) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	add = 0
	pre_sum = [0]
	for i in range(n):
		add += a[i]
		pre_sum.append(add)
	dict = {}
	dict[pre_sum[-1]] = 1
	d_and_c(0, n - 1)
	for i in range(q):
		puch = int(input())
		if puch in dict:
			print('Yes')
		else:
			print('No')


def any(l, r):
	global d
	mid = (a[l] + a[r]) // 2
	sum = 0
	new = 0
	for i in range(l, r + 1):
		sum += a[i]
		if a[i] > mid and new == 0:
			new = i
	d.add(sum)
	if new != 0:
		any(l, new - 1)
		any(new, r)
	return
t = int(input())
for _ in range(t):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	d = set()
	any(0, n - 1)
	for i in range(q):
		k = int(input())
		if k in d:
			print('Yes')
		else:
			print('No')


from sys import setrecursionlimit
setrecursionlimit(10 ** 8)

def check(a, mid):
	d[sum(a)] = 'Yes'
	for i in range(len(a)):
		if a[i] > mid:
			return i
	return len(a)

def breaker(a):
	ele = a[0]
	for i in a:
		if i != ele:
			return True
	return False

def answer(a):
	if breaker(a):
		mid = (max(a) + min(a)) // 2
		m = check(a, mid)
		answer(a[:m])
		answer(a[m:])
	else:
		check(a, 0)
for T in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	quaries = []
	for i in range(q):
		quaries.append(int(input()))
	a.sort()
	d = {}
	answer(a)
	for i in quaries:
		try:
			print(d[i])
		except:
			print('No')


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = []
for qu in range(T):
	(N, Q) = map(int, readline().split())
	A = list(map(int, readline().split()))
	A.sort()
	SA = A[:] + [0]
	for i in range(1, N):
		SA[i] += SA[i - 1]
	stack = [(0, N)]
	res = set()
	while stack:
		(l, r) = stack.pop()
		res.add(SA[r - 1] - SA[l - 1])
		if l + 1 == r:
			continue
		ave = (A[l] + A[r - 1]) // 2
		ok = l
		ng = r
		while abs(ok - ng) > 1:
			med = (ok + ng) // 2
			if A[med] <= ave:
				ok = med
			else:
				ng = med
		if l != ng and ng != r:
			stack.append((l, ng))
		if r != ng and ng != l:
			stack.append((ng, r))
	for _ in range(Q):
		s = int(readline())
		if s in res:
			Ans.append('Yes')
		else:
			Ans.append('No')
print('\n'.join(Ans))


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
from bisect import bisect_right as br

def f(a, d):
	m = (min(a) + max(a)) // 2
	temp = br(a, m)
	l = a[:temp]
	r = a[temp:]
	(L, R) = (0, 0)
	d.add(sum(l))
	d.add(sum(r))
	if not len(l) or not len(r):
		return
	if len(l) > 1:
		L = f(l, d)
	if len(r) > 1:
		R = f(r, d)
for _ in range(t()):
	(n, m) = ll()
	a = list(ll())
	a.sort()
	d = set()
	d.add(sum(a))
	f(a, d)
	for i in range(m):
		key = t()
		if key in d:
			print('YES')
		else:
			print('NO')


import sys
sys.setrecursionlimit(10000)
T = int(input())

def getSet(A):
	if len(A) < 2:
		return set(A)
	mid = (min(A) + max(A)) // 2
	sA = []
	bA = []
	for a in A:
		if a <= mid:
			sA.append(a)
		else:
			bA.append(a)
	if len(sA) == len(A):
		return set([sum(A)])
	ans = set([sum(sA), sum(bA)])
	return ans.union(getSet(sA).union(getSet(bA)))
for t in range(T):
	(n, Q) = map(int, input().split())
	A = list(map(int, input().split()))
	x = getSet(A)
	x.add(sum(A))
	for q in range(Q):
		ele = int(input())
		if ele in x:
			print('Yes')
		else:
			print('No')


st = set()

def calc(a, l, r):
	global st
	sum = 0
	for i in range(l, r + 1):
		sum += a[i]
	st.add(sum)
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	calc(a, l, pos)
	calc(a, pos + 1, r)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	st = set()
	a.sort()
	calc(a, 0, n - 1)
	for zy in range(q):
		s = int(input())
		if s in st:
			print('Yes')
		else:
			print('No')


def util(A, n, start, end, hash_set):
	mid = (A[start] + A[end]) // 2
	pos = -1
	sum = 0
	for i in range(start, end + 1):
		sum += A[i]
	hash_set.add(sum)
	for i in range(start, end + 1):
		if A[i] <= mid:
			pos = i
		else:
			break
	if pos == end or pos == -1:
		return
	util(A, n, start, pos, hash_set)
	util(A, n, pos + 1, end, hash_set)

def solve_4(A):
	A.sort()
	hash_set = set()
	hash_set.add(sum(A))
	util(A, len(A), 0, len(A) - 1, hash_set)
	return hash_set
t = int(input())
for z in range(t):
	(n, q) = input().split()
	n = int(n)
	q = int(q)
	A = [int(u) for u in input().split()][:n]
	s = solve_4(A)
	query = []
	for theta in range(q):
		s1 = int(input())
		query.append(s1)
	for x in query:
		if x in s:
			print('YES')
		else:
			print('NO')


import sys
from copy import *
from bisect import *
from math import gcd, ceil, sqrt

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
sys.setrecursionlimit(10 ** 5)
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def ii():
	return input().rstrip()

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()

def rec(l, r):
	if l > r:
		return
	if l == r:
		d[a[l]] = 1
		return
	mid = (a[l] + a[r]) // 2
	p = bisect_right(a[l:r + 1], mid) + l
	d[pre[p] - pre[l]] = 1
	d[pre[r + 1] - pre[p]] = 1
	if p == l or p == r + 1:
		return
	rec(l, p - 1)
	rec(p, r)
while t > 0:
	t -= 1
	(n, q) = mi()
	a = li()
	a.sort()
	d = {sum(a): 1}
	pre = [0]
	for i in a:
		pre.append(pre[-1] + i)
	rec(0, n - 1)
	for i in range(q):
		y = fi()
		print('Yes' if y in d else 'No')


import sys
input = sys.stdin.readline

def parts(A):
	MIN = min(A)
	MAX = max(A)
	mid = (MAX + MIN) // 2
	B = []
	C = []
	SUM = 0
	for a in A:
		if a <= mid:
			B.append(a)
		else:
			C.append(a)
		SUM += a
	ANS.add(SUM)
	return (B, C)
t = int(input())
for tests in range(t):
	(n, q) = map(int, input().split())
	A = list(map(int, input().split()))
	QUE = [int(input()) for i in range(q)]
	Q = [A]
	ANS = set()
	while Q:
		a = Q.pop()
		(B, C) = parts(a)
		if B != [] and B != a:
			Q.append(B)
		if C != [] and C != a:
			Q.append(C)
	for q in QUE:
		if q in ANS:
			print('Yes')
		else:
			print('No')


from sys import stdin, stdout
input = stdin.readline

def f(a):
	if len(a) <= 1:
		return
	mid = (max(a) + min(a)) // 2
	a1 = [a[i] for i in range(len(a)) if a[i] <= mid]
	a2 = [a[i] for i in range(len(a)) if a[i] > mid]
	if len(a1) > 0:
		if sum(a1) in dict:
			for i in dict[sum(a1)]:
				ans[i] = 1
	if len(a2) > 0:
		if sum(a2) in dict:
			for i in dict[sum(a2)]:
				ans[i] = 1
	if len(set(a1)) > 1:
		f(a1)
	if len(set(a2)) > 1:
		f(a2)
t = int(input())
for _ in range(t):
	(n, q) = map(int, input().split())
	ans = [0 for i in range(q)]
	a = [int(x) for x in input().split()]
	dict = {}
	for i in range(q):
		x = int(input())
		if x in dict:
			dict[x].append(i)
		else:
			dict[x] = [i]
	if sum(a) in dict:
		for i in dict[sum(a)]:
			ans[i] = 1
	f(a)
	for i in ans:
		if i:
			print('yes')
		else:
			print('no')


from bisect import bisect_right
t = int(input())

def transitions(start, end, a, hashmap, prefix_sum):
	if start == 0:
		hashmap.add(prefix_sum[end])
	else:
		hashmap.add(prefix_sum[end] - prefix_sum[start - 1])
	if start == end:
		return
	else:
		mid = (a[start] + a[end]) // 2
		ind = bisect_right(a, mid)
		if ind > end:
			return
		transitions(start, ind - 1, a, hashmap, prefix_sum)
		transitions(ind, end, a, hashmap, prefix_sum)
for _ in range(t):
	(n, q) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	a.sort()
	prefix_sum = [0 for _ in range(n)]
	prefix_sum[0] = a[0]
	for i in range(1, len(a)):
		prefix_sum[i] = a[i] + prefix_sum[i - 1]
	hashmap = set()
	transitions(0, n - 1, a, hashmap, prefix_sum)
	for i in range(0, q):
		x = int(input())
		if x in hashmap:
			print('Yes')
		else:
			print('No')


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math
sys.setrecursionlimit(100000)
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def prefix_sum(arr):
	r = [0] * (len(arr) + 1)
	for (i, el) in enumerate(arr):
		r[i + 1] = r[i] + el
	return r

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')

def fun(a):
	if a == []:
		return
	if len(a) == 1:
		d[a[0]] += 1
		return
	if len(set(a)) == 1:
		d[sum(a)] += 1
		return
	d[sum(a)] += 1
	m = a[0] + a[-1]
	m //= 2
	b = []
	c = []
	for i in range(len(a)):
		if a[i] <= m:
			b.append(a[i])
		else:
			c.append(a[i])
	fun(b)
	fun(c)
t = 1
t = int(input())
for _ in range(t):
	(n, q) = li()
	a = li()
	d = defaultdict(lambda : 0)
	a.sort()
	fun(a)
	for i in range(q):
		s = ii()
		if d[s] >= 1:
			print('Yes')
		else:
			print('No')


s = set()

def rec(a):
	s.add(sum(a))
	if len(a) > 1:
		c = (min(a) + max(a)) / 2
		sl = sr = 0
		left = []
		right = []
		for i in a:
			if i <= c:
				left += (i,)
				sl += i
			else:
				right += (i,)
				sr += i
		s.add(sl)
		s.add(sr)
		if sl and right:
			rec(left)
		if sr and left:
			rec(right)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	s.clear()
	rec(a)
	for i in range(q):
		x = int(input())
		if x in s:
			print('Yes')
		else:
			print('No')


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

def output(answer):
	stdout.write(str(answer))

def solve(l, r):
	global getable, arr
	total = 0
	mid = (arr[l] + arr[r]) // 2
	for i in range(l, r + 1):
		total += arr[i]
	getable.add(total)
	pos = -1
	for i in range(l, r + 1):
		if arr[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	solve(l, pos)
	solve(pos + 1, r)
num = int(z())
for i in range(num):
	(n, m) = zzz()
	arr = szzz()
	getable = set()
	solve(0, n - 1)
	for i in range(m):
		x = int(fast())
		if x in getable:
			print('Yes')
		else:
			print('No')


import sys, os, io
from collections import defaultdict
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def fun(arr):
	s = sum(arr)
	dic[s] = 1
	ma = max(arr)
	mi = min(arr)
	if ma == mi:
		return
	mid = (ma + mi) // 2
	a1 = []
	a2 = []
	for i in arr:
		if i <= mid:
			a1.append(i)
		else:
			a2.append(i)
	fun(a1)
	fun(a2)
for _ in range(int(input())):
	(n, q) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	dic = defaultdict(lambda : 0)
	fun(a)
	for i in range(q):
		n = int(input())
		if dic[n]:
			print('Yes')
		else:
			print('No')


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
DEBUG_MODE = False

def debug(*args, **kwargs):
	if DEBUG_MODE:
		print(*args, **kwargs)
from decimal import Decimal, getcontext
getcontext().prec = 20
from bisect import bisect_right

def main():
	T = iin()
	while T:
		T -= 1
		(n, q) = lin()
		a = lin()
		a.sort()
		q = [iin() for i in range(q)]
		ps = a[:] + [0]
		for i in range(1, n):
			ps[i] += ps[i - 1]
		s_sums = set()

		def solve(l, r):
			if l > r:
				return
			s_sums.add(ps[r] - ps[l - 1])
			if l < r:
				(mx, mn) = (a[r], a[l])
				md = (mx + mn) // 2
				if md == mx:
					return
				pos = bisect_right(a, md, l, r)
				if pos > r:
					return
				solve(l, pos - 1)
				solve(pos, r)
		solve(0, n - 1)
		for val in q:
			print('YES' if val in s_sums else 'NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def iin(default_type=int):
	return default_type(input())

def lin(default_type=int):
	return list(map(default_type, input().split()))
if DEBUG_MODE:
	import cProfile
	cProfile.run('main()')
else:
	main()


import math
import bisect

def fct(sums_finder, sums_arr, arr, l, r):
	mean_floor = math.floor((arr[l] + arr[r]) / 2)
	mid = bisect.bisect_left(arr, mean_floor + 1, l, r)
	sums_finder[sums_arr[r + 1] - sums_arr[l]] = 1
	if arr[l] != arr[r]:
		fct(sums_finder, sums_arr, arr, l, mid - 1)
		fct(sums_finder, sums_arr, arr, mid, r)

def divide_and_summarize():
	for _ in range(int(input())):
		(n, m) = list(map(int, input().split()))
		arr = list(map(int, input().split()))
		arr.sort()
		arr = arr
		sum_arr = [0]
		for i in range(n):
			sum_arr += [sum_arr[-1] + arr[i]]
		sums_finder = dict()
		fct(sums_finder, sum_arr, arr, 0, n - 1)
		for _ in range(m):
			q_x = int(input())
			print('YES' if q_x in sums_finder else 'NO')
divide_and_summarize()


import sys
input = sys.stdin.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().strip('\r\n')

def cal(l, r):
	cur = 0
	for i in range(l, r + 1):
		cur += a[i]
	h.add(cur)
	pos = -1
	mid = (a[l] + a[r]) // 2
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
			cur += a[i]
		else:
			break
	if pos == -1 or pos == r:
		return
	cal(l, pos)
	cal(pos + 1, r)
for _ in range(ri()):
	h = set()
	(n, q) = rl()
	a = rl()
	a.sort()
	cal(0, n - 1)
	for _ in range(q):
		s = ri()
		if s in h:
			print('Yes')
		else:
			print('No')


q = set()
a = []

def go(l, r):
	global a, q
	sum = 0
	for i in range(l, r + 1):
		sum += a[i]
	q.add(sum)
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	go(l, pos)
	go(pos + 1, r)

def solve():
	global a, q
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	q = set()
	a.sort()
	go(0, n - 1)
	for _ in range(m):
		x = int(input())
		if x in q:
			print('YES')
		else:
			print('NO')
tests = int(input())
while tests > 0:
	solve()
	tests = tests - 1


import bisect

def sol(a):
	suma.add(sum(a))
	mid = (a[0] + a[-1]) // 2
	i = bisect.bisect(a, mid)
	if i == len(a):
		return
	left = a[:i]
	right = a[i:]
	sol(left)
	sol(right)
t = int(input())
for j in range(t):
	(n, q) = [int(i) for i in input().split()]
	a = [int(i) for i in input().split()]
	suma = set()
	sol(sorted(a))
	for i in range(q):
		s = int(input())
		if s in suma:
			print('Yes')
		else:
			print('No')


t = int(input())

def f(a, d):
	mn = 10 ** 9
	mx = 0
	sum = 0
	for i in range(len(a)):
		mx = max(mx, a[i])
		mn = min(mn, a[i])
		sum += a[i]
	d[sum] = 1
	if mx == mn:
		return
	m = (mx + mn) // 2
	l = []
	r = []
	for j in range(len(a)):
		if a[j] <= m:
			l.append(a[j])
		else:
			r.append(a[j])
	f(l, d)
	f(r, d)
for _ in range(t):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	d = {}
	f(a, d)
	for j in range(q):
		s = int(input())
		if s in d:
			print('Yes')
		else:
			print('No')


def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return r

def main(search, i, j, d, ans):
	if j - i <= 1:
		ans.add(d[search[i]] * search[i])
		return
	search_val = (search[i] + search[j - 1]) // 2
	x = binarySearch(search, i, j, search_val)
	s1 = 0
	s2 = 0
	for k in range(i, x + 1):
		s1 += d[search[k]] * search[k]
	for k in range(x + 1, j):
		s2 += d[search[k]] * search[k]
	ans.add(s1)
	ans.add(s2)
	return (main(search, i, x + 1, d, ans), main(search, x + 1, j, d, ans))
t = int(input())
for _ in range(t):
	(n, q) = map(int, input().split())
	arr = list(map(int, input().split()))
	d = {}
	for i in arr:
		if i not in d.keys():
			d.update({i: 1})
		else:
			d[i] += 1
	arr.sort()
	a = sum(arr)
	search = list(set(arr))
	z = len(search)
	ans = {a}
	main(search, 0, z, d, ans)
	for i in range(q):
		s = int(input())
		if s in ans:
			print('Yes')
		else:
			print('No')


import sys
sys.setrecursionlimit(10 ** 5)

def aps(ar):
	global d
	s = 0
	a = max(ar)
	b = min(ar)
	s = sum(ar)
	d[s] = 0
	if len(set(ar)) == 1:
		return
	else:
		n = len(ar)
		mid = (a + b) // 2
		(l, r) = ([], [])
		for i in range(n):
			if ar[i] > mid:
				l.append(ar[i])
			else:
				r.append(ar[i])
	aps(l)
	aps(r)
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	ar = list(map(int, input().split()))
	d = {}
	aps(ar)
	for i in range(m):
		num = int(input())
		if num in d:
			print('Yes')
		else:
			print('No')


import copy
t = int(input())

def fun(l, r, data, comsum, res):
	if l == r:
		res.add(data[l])
		return
	if data[l] == data[r]:
		res.add(comsum[r] - comsum[l] + data[l])
		return
	if r == l + 1:
		res.add(data[l])
		res.add(data[r])
		res.add(data[l] + data[r])
		return
	mid = (data[l] + data[r]) // 2
	(l1, r1) = (l, r)
	m = (r1 + l1) // 2
	while l1 < r1:
		if data[m] <= mid:
			l1 = m + 1
		elif data[m] > mid:
			r1 = m
		m = (r1 + l1) // 2
	if m - 1 == r:
		res.add(comsum[r] - comsum[l] + data[l])
		return
	res.add(comsum[r] - comsum[l] + data[l])
	fun(l, m - 1, data, comsum, res)
	fun(m, r, data, comsum, res)
	return
for _ in range(t):
	(n, q) = map(int, input().split())
	data = sorted(map(int, input().split()))
	comsum = copy.copy(data)
	for i in range(1, n):
		comsum[i] += comsum[i - 1]
	res = set()
	fun(0, n - 1, data, comsum, res)
	for k in range(q):
		q = int(input())
		if q in res:
			print('Yes')
		else:
			print('No')


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def binary_search(arr, low, high, x):
	while low != high:
		mid = (low + high) // 2
		if arr[mid] <= x:
			low = mid + 1
		else:
			high = mid
	return low

def calculatePrefixSum(n, a):
	prefixSum = [0 for i in range(n + 1)]
	for i in range(n):
		prefixSum[i + 1] = prefixSum[i] + a[i]
	return prefixSum

def divideAndConquer(left, right, a, sums, prefixSum):
	if left >= right + 1:
		return
	sum = prefixSum[right + 1] - prefixSum[left]
	sums.add(sum)
	midValue = (a[left] + a[right]) // 2
	split = binary_search(a, left, right + 1, midValue) - 1
	if split == -1 or split == right:
		return
	divideAndConquer(left, split, a, sums, prefixSum)
	divideAndConquer(split + 1, right, a, sums, prefixSum)

def solve():
	(n, q) = get_ints()
	a = get_list()
	a.sort()
	sums = set()
	prefixSum = calculatePrefixSum(n, a)
	divideAndConquer(0, n - 1, a, sums, prefixSum)
	for _ in range(q):
		s_i = int(input())
		if s_i in sums:
			print('YES')
		else:
			print('NO')

def main():
	T = int(input())
	for _ in range(T):
		solve()
main()


def slice(a, s):
	s.add(sum(a))
	if len(set(a)) > 1:
		mid = (max(a) + min(a)) // 2
		i = 0
		while i < len(a) and a[i] <= mid:
			i += 1
		slice(a[:i], s)
		slice(a[i:], s)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = [int(x) for x in input().split()]
	a.sort()
	s = set()
	slice(a, s)
	for i in range(q):
		x = int(input())
		if x in s:
			print('Yes')
		else:
			print('No')


from bisect import *

def chidori(arr, l, r, ans):
	tot = sum(arr[l:r + 1])
	if tot not in ans:
		ans[tot] = True
	if arr[l] == arr[r]:
		return
	val = (arr[l] + arr[r]) // 2
	mid = bisect_right(arr, val)
	x = chidori(arr, l, mid - 1, ans)
	y = chidori(arr, mid, r, ans)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	tot = sum(a)
	ans = {tot: True}
	chidori(a, 0, n - 1, ans)
	for queries in range(q):
		x = int(input())
		if x not in ans:
			print('No')
		else:
			print('Yes')


import sys, bisect
t = int(input())
for _ in range(t):
	(n, q) = map(int, input().strip(' ').split(' '))
	arr = list(map(int, input().strip(' ').split(' ')))
	arr.sort()
	prty = set()

	def divide(l, h):
		if l > h:
			return 0
		if arr[l] == arr[h]:
			x = arr[l] * (h - l + 1)
			prty.add(x)
			return x
		mi = (arr[l] + arr[h]) // 2
		mid = bisect.bisect_right(arr, mi, l, h)
		x = divide(l, mid - 1) + divide(mid, h)
		prty.add(x)
		return x
	divide(0, n - 1)
	for i in range(q):
		x = int(input())
		if x in prty:
			print('Yes')
		else:
			print('No')


import sys
input = sys.stdin.readline
from bisect import bisect_left, bisect_right

def ssum(arr):
	if arr[0] == arr[-1]:
		ss.add(sum(arr))
		return
	ss.add(sum(arr))
	mid = (arr[0] + arr[-1]) // 2
	mid_index = bisect_right(arr, mid)
	ssum(arr[:mid_index])
	ssum(arr[mid_index:])
	return
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	ss = set()
	ssum(a)
	for _ in range(q):
		if int(input()) in ss:
			print('YES')
		else:
			print('NO')


import math
from pprint import pprint
import sys
from bisect import bisect_left, bisect_right

def do():
	import itertools
	squery = lambda a, b: sdat[b] - sdat[a]

	def createSDAT(l):
		return list(itertools.accumulate(itertools.chain([0], l)))
	(n, qs) = map(int, input().split())
	dat = list(map(int, input().split()))
	dat.sort()
	sdat = createSDAT(dat)
	can = dict()
	from collections import deque
	q = deque([])
	total = squery(0, n)
	q.append([0, n, total])
	while len(q) > 0:
		(l, r, total) = q.popleft()
		can[total] = True
		(lval, rval) = (dat[l], dat[r - 1])
		if lval == rval:
			continue
		mid = math.floor((rval + lval) / 2)
		midind = bisect_right(dat, mid, lo=l, hi=r)
		rtotal = total - squery(l, midind)
		ltotal = total - squery(midind, r)
		q.append([l, midind, ltotal])
		q.append([midind, r, rtotal])
	for qq in range(qs):
		ss = int(input())
		if ss in can:
			print('Yes')
		else:
			print('No')
q = int(input())
for _ in range(q):
	do()


import sys
import math
from collections import defaultdict, deque
import bisect
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def func(arr, result, dp, start, end):
	if start > end:
		return
	if start == end:
		result.add(arr[start])
		return
	mid = (arr[start] + arr[end]) // 2
	ind = bisect.bisect_right(arr, mid)
	if start == 0:
		result.add(dp[ind - 1])
		if end >= ind:
			result.add(dp[end] - dp[ind - 1])
	else:
		result.add(dp[ind - 1] - dp[start - 1])
		if end >= ind:
			result.add(dp[end] - dp[ind - 1])
	if ind > end:
		return
	func(arr, result, dp, start, ind - 1)
	func(arr, result, dp, ind, end)
	return

def main():
	t = int(input())
	for _ in range(t):
		(n, q) = inar()
		arr = inar()
		result = set()
		arr.sort()
		dp = [0] * n
		result.add(sum(arr))
		for i in range(n):
			if i == 0:
				dp[i] = arr[i]
				continue
			dp[i] = arr[i] + dp[i - 1]
		func(arr, result, dp, 0, n - 1)
		for i in range(q):
			take = int(input())
			if take in result:
				print('Yes')
			else:
				print('No')
main()


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def prefixSum(arr):
	prefix = [sum(arr[:i + 1]) for i in range(len(arr))]
	prefix.insert(0, 0)
	return prefix

def divideAndConquer(left, right, a, sums):
	sum = 0
	for i in range(left, right + 1):
		sum += a[i]
	sums.add(sum)
	midValue = (a[left] + a[right]) // 2
	split = -1
	for i in range(left, right + 1):
		if a[i] > midValue:
			break
		else:
			split = i
	if split == -1 or split == right:
		return
	divideAndConquer(left, split, a, sums)
	divideAndConquer(split + 1, right, a, sums)

def solve():
	(n, q) = get_ints()
	a = get_list()
	a.sort()
	sums = set()
	divideAndConquer(0, n - 1, a, sums)
	for _ in range(q):
		s_i = int(input())
		if s_i in sums:
			print('YES')
		else:
			print('NO')

def main():
	T = int(input())
	for _ in range(T):
		solve()
main()


sums = {}

def find_sum(array, begin, end):
	sums[sum(array[begin:end + 1])] = True

def process_sums(array, begin, end):
	find_sum(array, begin, end)
	mid = (array[begin] + array[end]) // 2
	pos = None
	for p in range(begin, end + 1):
		if array[p] > mid:
			pos = p - 1
			break
	if pos is None or pos == end:
		return
	process_sums(array, begin, pos)
	process_sums(array, pos + 1, end)

def get_q():
	return int(input().split()[1])

def get_numbers():
	nums = list(map(int, input().split()))
	nums.sort()
	return nums
for _ in range(int(input())):
	q = get_q()
	numbers = get_numbers()
	sums.clear()
	process_sums(numbers, 0, len(numbers) - 1)
	for i in range(q):
		print('Yes') if int(input()) in sums else print('No')


from bisect import bisect
from itertools import accumulate

def solve():
	(n, q) = map(int, input().split())
	array = list(map(int, input().split()))
	sums = [int(input()) for _ in range(q)]
	array.sort()
	prefixSum = [0] + list(accumulate(array))

	def totalSum(end, start):
		return prefixSum[end] - prefixSum[start]
	pool = set()

	def gather(start, end):
		total = totalSum(end, start)
		pool.add(total)
		if array[start] == array[end - 1]:
			return
		mid = (array[start] + array[end - 1]) // 2
		i = bisect(array, mid)
		gather(start, i)
		gather(i, end)
	gather(0, len(array))
	for s in sums:
		print('Yes' if s in pool else 'No')
for _ in range(int(input())):
	solve()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():

	def rec(l, r):
		pos = bisect.bisect(a, (a[r] + a[l]) // 2, l, r + 1)
		if l == r:
			d[prefsum[r + 1] - prefsum[l]] = 1
		elif l < r:
			if pos <= r:
				rec(l, pos - 1)
				rec(pos, r)
			d[prefsum[r + 1] - prefsum[l]] = 1
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = ri()
	for _ in range(tc):
		(n, q) = ria()
		d = {}
		a = sorted(ria())
		prefsum = [0]
		for i in a:
			prefsum += [prefsum[-1] + i]
		rec(0, n - 1)
		for i in range(q):
			if ri() in d:
				ws('Yes')
			else:
				ws('No')
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def mark(x):
	global d
	if x in d:
		d[x] = 1
	return

def sl(a):
	global d
	if a == []:
		return mark(0)
	if len(a) == 1:
		return mark(a[0])
	m = (max(a) + min(a)) // 2
	(b, c, sumb, sumc) = ([], [], 0, 0)
	for x in a:
		if x <= m:
			b += [x]
			sumb += x
		else:
			c += [x]
			sumc += x
	mark(sumb)
	mark(sumc)
	mark(sumb + sumc)
	if sumc == 0 or sumb == 0:
		return
	sl(b)
	sl(c)
	return
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = [int(x) for x in input().split()]
	s = [int(input()) for _ in range(q)]
	d = {s[x]: 0 for x in range(q)}
	sl(a)
	for x in s:
		if d[x]:
			print('Yes')
		else:
			print('No')


import math
t = int(input())

def find(a, s):
	s.add(sum(a))
	if len(a) <= 1:
		return
	l = []
	r = []
	ma = max(a)
	mi = min(a)
	rr = math.floor((ma + mi) / 2)
	for i in a:
		if i <= rr:
			l.append(i)
		else:
			r.append(i)
	if len(l) == 0 or len(r) == 0:
		s.add(sum(a))
		return
	find(l, s)
	find(r, s)
for _ in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	s = set()
	s.add(sum(a))
	find(a, s)
	for i in range(m):
		ss = int(input())
		if ss in s:
			print('Yes')
		else:
			print('No')


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
q = set()
a = []

def go(l, r):
	global a, q
	su = 0
	for i in range(l, r + 1):
		su += a[i]
	q.add(su)
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	go(l, pos)
	go(pos + 1, r)

def solve():
	global a, q
	(n, m) = zzz()
	a = szzz()
	q = set()
	go(0, n - 1)
	for i in range(m):
		x = int(fast())
		if x in q:
			print('YES')
		else:
			print('NO')
for i in range(int(fast())):
	solve()


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def get_input(a=str):
	return a(input())

def get_int_input():
	return get_input(int)

def get_input_arr(a):
	return list(map(a, input().split()))

def get_int_input_arr():
	return get_input_arr(int)
import bisect

def solve():
	t = get_int_input()
	for _ in range(t):
		(n, q) = get_int_input_arr()
		arr = get_int_input_arr()
		arr.sort()
		stack = set()
		stack.add((0, n - 1))
		prefx_sm = [0] * (n + 1)
		for i in range(1, n + 1):
			prefx_sm[i] = prefx_sm[i - 1] + arr[i - 1]
		res_set = set()
		while stack:
			ele = stack.pop()
			(x, y) = ele
			res_set.add(prefx_sm[y + 1] - prefx_sm[x])
			mid = (arr[x] + arr[y]) // 2
			if x == y or arr[x] == arr[y]:
				continue
			idx = x
			while arr[idx] <= mid:
				idx += 1
			if x <= idx - 1:
				stack.add((x, idx - 1))
			if idx <= y:
				stack.add((idx, y))
		for _ in range(q):
			q_e = get_int_input()
			if q_e in res_set:
				cout << 'Yes' << endl
			else:
				cout << 'No' << endl

def main():
	solve()
main()


from bisect import *

def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1

def chidori(arr, l, r, ans, prefix):
	if l == 0:
		tot = prefix[r]
	else:
		tot = prefix[r] - prefix[l - 1]
	if arr[l] == arr[r]:
		ans.append(tot)
		return
	val = (arr[l] + arr[r]) // 2
	mid = bisect_right(arr, val)
	x = chidori(arr, l, mid - 1, ans, prefix)
	y = chidori(arr, mid, r, ans, prefix)
	ans.append(tot)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	tot = sum(a)
	prefix = [a[0]]
	for i in range(1, n):
		prefix.append(prefix[-1] + a[i])
	ans = [tot]
	chidori(a, 0, n - 1, ans, prefix)
	ans.sort()
	for queries in range(q):
		x = int(input())
		if binarySearch(ans, 0, len(ans) - 1, x) == -1:
			print('No')
		else:
			print('Yes')


def bc(i, j, c):
	ans = -1
	while i <= j:
		mid = i + (j - i) // 2
		if l[mid] > c:
			ans = mid
			j = mid - 1
		else:
			i = mid + 1
	return ans

def abc(i, j):
	d[dp[j + 1] - dp[i]] = 0
	c = (l[j] + l[i]) // 2
	index = bc(i, j, c)
	if index == -1:
		return
	abc(i, index - 1)
	abc(index, j)
import random
t = int(input())
dp = []
l = []
d = {}
for _ in range(t):
	(n, q) = map(int, input().split())
	l = list(map(int, input().split()))
	dp = [0] * (n + 1)
	l.sort()
	for i in range(n):
		dp[i + 1] = dp[i] + l[i]
	abc(0, n - 1)
	for i in range(q):
		x = int(input())
		try:
			c = d[x]
			print('Yes')
		except:
			print('No')
	d = {}


import sys
import bisect
from bisect import bisect_right
import math
from sys import stdin, stdout

def sieve(N):
	primeNumbers = [True] * (N + 1)
	primeNumbers[0] = False
	primeNumbers[1] = False
	i = 2
	while i * i <= N:
		j = i
		if primeNumbers[j]:
			while j * i <= N:
				primeNumbers[j * i] = False
				j += 1
		i += 1
	return primeNumbers

def getPrime(N):
	primes = sieve(N)
	result = []
	for i in range(len(primes)):
		if primes[i]:
			result.append(i)
	return result

def factor(N):
	factors = []
	i = 1
	while i * i <= N:
		if N % i == 0:
			factors.append(i)
			if i != N // i:
				factors.append(N // i)
		i += 1
	return sorted(factors)

def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)

def extendedGcd(a, b):
	if a < b:
		return extendedGcd(b, a)
	if b == 0:
		return [a, 1, 0]
	res = extendedGcd(b, a % b)
	x = res[2]
	y = res[1] - math.floor(a / b) * res[2]
	res[1] = x
	res[2] = y
	return res

def iterativeModularFunc(a, b, c):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % c
		a = a * a % c
		b = b // 2
	return res

def get_ints_in_variables():
	return map(int, sys.stdin.readline().strip().split())

def get_int():
	return int(input())

def get_ints_in_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

def get_string():
	return sys.stdin.readline().strip()

def helper(arr, n, i, j, hm):
	s = 0
	for k in range(i, j + 1):
		s += arr[k]
	hm[s] = True
	mid = (arr[i] + arr[j]) // 2
	pos = -1
	for k in range(i, j + 1):
		if arr[k] <= mid:
			pos = k
		else:
			break
	if pos == -1 or pos == j:
		return
	helper(arr, n, i, pos, hm)
	helper(arr, n, pos + 1, j, hm)

def Solution(arr, n, q):
	arr = sorted(arr)
	hm = {}
	helper(arr, n, 0, n - 1, hm)
	for _ in range(q):
		if get_int() in hm:
			print('YES')
		else:
			print('NO')

def main():
	for _ in range(get_int()):
		(n, q) = get_ints_in_variables()
		arr = get_ints_in_list()
		Solution(arr, n, q)
main()


from bisect import bisect, bisect_left
import sys
input = sys.stdin.readline

def rec(pi, pj, i, j):
	m = (i + j) // 2
	mj = bisect(l, j) - 1
	mi = bisect_left(l, i)
	x = bisect(l, m) - 1
	if i == pi and j == pj:
		return
	pi = i
	pj = j
	o.add(pa[mj] - pb[mi])
	if l[x] >= i:
		rec(pi, pj, i, l[x])
	if x + 1 != n and j >= l[x + 1]:
		rec(pi, pj, l[x + 1], j)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	pa = []
	pb = []
	som = 0
	for i in l:
		pb.append(som)
		som += i
		pa.append(som)
	o = set()
	rec(-1, -1, l[0], l[-1])
	for u in range(q):
		x = int(input())
		if x in o:
			sys.stdout.write('YES')
		else:
			sys.stdout.write('NO')
		sys.stdout.write('\n')


t = int(input())

def dfs(arr: []) -> set:
	if not arr:
		return
	tmp = {sum(arr)}
	mid = (max(arr) + min(arr)) // 2
	left = []
	right = []
	for i in arr:
		if i <= mid:
			left.append(i)
		else:
			right.append(i)
	if left and right:
		tmp |= dfs(left)
		tmp |= dfs(right)
	return tmp
for _ in range(t):
	(n, q) = [int(i) for i in input().split()]
	arr1 = [int(i) for i in input().split()]
	tmp = dfs(arr1)
	for _ in range(q):
		target = int(input())
		if target in tmp:
			print('Yes')
		else:
			print('No')


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
a = []
c = set()

def fun(l, r):
	ans = 0
	for i in range(l, r + 1):
		ans += a[i]
	c.add(ans)
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	fun(l, pos)
	fun(pos + 1, r)
t = int(input())
for k in range(t):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))[:n]
	a.sort()
	fun(0, n - 1)
	for i in range(q):
		x = int(input())
		if x in c:
			print('YES')
		else:
			print('NO')
	c.clear()


import sys
import bisect
sys.setrecursionlimit(100000)
(*data,) = sys.stdin.read().split('\n')[::-1]

def input():
	return data.pop()

def calc(arr, left, right, prefixes, sums):
	if left <= right:
		sums.add(prefixes[right + 1] - prefixes[left])
		mid = (arr[right] + arr[left]) // 2
		pos = bisect.bisect_right(arr, mid, left, right + 1)
		if pos != right + 1:
			calc(arr, left, pos - 1, prefixes, sums)
			calc(arr, pos, right, prefixes, sums)
answers = []
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	(*arr,) = map(int, input().split())
	qs = []
	for _ in range(q):
		qs.append(int(input()))
	arr.sort()
	s = sum(arr)
	prefixes = [0]
	for v in arr:
		prefixes.append(prefixes[-1] + v)
	sums = set()
	calc(arr, 0, n - 1, prefixes, sums)
	answers.extend(('YES' if query in sums else 'NO' for query in qs))
print('\n'.join(answers))


import sys

def sip():
	return sys.stdin.readline().rstrip()

def gen_test_cases():
	num_tests = int(sip())
	for i in range(num_tests):
		(len_a, num_pt) = map(int, sip().split(' '))
		a = list(map(int, sip().split(' ')))
		pts = [int(sip()) for _ in range(num_pt)]
		yield (len_a, a, num_pt, pts)

def mktree(xs, parent):
	mid = (max(xs) + min(xs)) // 2
	left = list(filter(lambda a: a <= mid, xs))
	right = list(filter(lambda a: a > mid, xs))
	node = {'parent': parent}
	if left and right:
		return {'parent': parent, 'left': mktree(left, node), 'right': mktree(right, node)}
	else:
		return {'parent': parent, 'sum': sum(xs)}

def sum_of(node, acc):
	if 'sum' not in node:
		node['sum'] = sum_of(node['left'], acc) + sum_of(node['right'], acc)
	acc.add(node['sum'])
	return node['sum']
for (len_a, a, num_pts, pts) in gen_test_cases():
	root = mktree(a, None)
	acc = set()
	sum_of(root, acc)
	for pt in pts:
		print('Yes' if pt in acc else 'No')


def solve(Arr):
	Store[sum(Arr)] = 1
	x = max(Arr)
	y = min(Arr)
	mid = (x + y) // 2
	left = list(filter(lambda j: j <= mid, Arr))
	right = list(filter(lambda j: j > mid, Arr))
	if len(left) == len(Arr) or len(right) == len(Arr):
		return ()
	solve(left)
	solve(right)
n = int(input())
for i in range(n):
	(p, q) = [int(x) for x in input().split()]
	List = [int(x) for x in input().split()]
	Store = dict()
	solve(List)
	for j in range(q):
		t = int(input())
		if t in Store:
			print('YES')
		else:
			print('NO')


def calc(a, st, l, r):
	sum_ = 0
	for i in range(l, r + 1):
		sum_ += a[i]
	st.add(sum_)
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	calc(a, st, l, pos)
	calc(a, st, pos + 1, r)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = sorted(map(int, input().split()))
	st = set()
	calc(a, st, 0, n - 1)
	for __ in range(q):
		x = int(input())
		if x in st:
			print('Yes')
		else:
			print('No')


import sys
input = sys.stdin.buffer.readline
pos = set()

def find_sum(a):
	global pos
	pos.add(sum(a))
	mx = max(a)
	mn = min(a)
	if mx == mn:
		return
	mid = (mx + mn) // 2
	left = []
	right = []
	for i in a:
		if i <= mid:
			left.append(i)
		else:
			right.append(i)
	find_sum(left)
	find_sum(right)

def prog():
	global pos
	for _ in range(int(input())):
		(n, q) = map(int, input().split())
		a = list(map(int, input().split()))
		pos.clear()
		find_sum(a)
		for i in range(q):
			s = int(input())
			if s in pos:
				print('Yes')
			else:
				print('No')
prog()


def f(i, j):
	r.add(sum(a[i:j]))
	k = i
	while k < j and 2 * a[k] <= a[i] + a[j - 1]:
		k += 1
	if k < j:
		f(i, k)
		f(k, j)
R = lambda : map(int, input().split())
(t,) = R()
for _ in [0] * t:
	(n, q) = R()
	a = sorted(R())
	r = {0}
	f(0, n)
	for _ in [0] * q:
		(s,) = R()
		print('NYoe s'[s in r::2])


def find_sum(arr):
	if len(arr) == 1:
		s.append(arr[0])
		return
	elif len(arr) == 0:
		return
	elif len(set(arr)) == 1:
		s.append(sum(arr))
		return
	s.append(sum(arr))
	(a, b) = ([], [])
	for i in arr:
		if i <= (arr[0] + arr[-1]) // 2:
			a.append(i)
		else:
			b.append(i)
	find_sum(a)
	find_sum(b)
for nt in range(int(input())):
	(n, q) = map(int, input().split())
	a = sorted(list(map(int, input().split())))
	s = []
	find_sum(a)
	s = set(s)
	for i in range(q):
		summ = int(input())
		if summ in s:
			print('Yes')
		else:
			print('NO')


def search(l, r):
	sis.add(sum(a[l:r + 1]))
	mid = (a[l] + a[r]) // 2
	pos = -1
	for i in range(l, r + 1):
		if a[i] <= mid:
			pos = i
		else:
			break
	if pos == -1 or pos == r:
		return
	search(l, pos)
	search(pos + 1, r)
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = list(map(int, input().split()))
	qs = []
	sis = set()
	for i in range(q):
		qs.append(int(input()))
	a.sort()
	search(0, n - 1)
	for i in range(q):
		if qs[i] in sis:
			print('YES')
		else:
			print('NO')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

class Rangemin:

	def __init__(self, data, func=min):
		self.func = func
		self._data = _data = [list(data)]
		(i, n) = (1, len(_data[0]))
		while 2 * i <= n:
			prev = _data[-1]
			_data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)])
			i <<= 1

	def query(self, start, stop):
		depth = (stop - start).bit_length() - 1
		return self.func(self._data[depth][start], self._data[depth][stop - (1 << depth)])

class Rangemax:

	def __init__(self, data, func=max):
		self.func = func
		self._data = _data = [list(data)]
		(i, n) = (1, len(_data[0]))
		while 2 * i <= n:
			prev = _data[-1]
			_data.append([func(prev[j], prev[j + i]) for j in range(n - 2 * i + 1)])
			i <<= 1

	def query(self, start, stop):
		depth = (stop - start).bit_length() - 1
		return self.func(self._data[depth][start], self._data[depth][stop - (1 << depth)])
have = {}

@iterative
def rec(a, l, r, pre):
	if l > r:
		yield True
	if l == r:
		have[a[l]] = 1
		yield True
	global rmax, rmin
	mid = (rmax.query(l, r + 1) + rmin.query(l, r + 1)) // 2
	if rmax.query(l, r + 1) == rmin.query(l, r + 1):
		have[pre[r] - pre[l - 1]] = 1
		yield True
	ind = br(a, mid)
	have[pre[ind - 1] - pre[l - 1]] = 1
	have[pre[r] - pre[ind - 1]] = 1
	ok = (yield rec(a, l, ind - 1, pre))
	ok = (yield rec(a, ind, r, pre))
	yield True

def solve(case):
	(n, q) = sep()
	a = lis()
	a.sort()
	global rmax, rmin, have
	have = {sum(a): 1}
	rmax = Rangemax(a)
	rmin = Rangemin(a)
	pre = [0] * (n + 1)
	for i in range(n):
		pre[i] = pre[i - 1] + a[i]
	rec(a, 0, n - 1, pre)
	for i in range(q):
		chck = int(inp())
		if chck in have:
			print('Yes')
		else:
			print('No')
(rmax, rmin) = (0, 0)
testcase(int(inp()))


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *

def solve(arr):
	dic = {}

	def help(arr):
		if arr[0] == arr[-1]:
			dic[sum(arr)] = 1
			return
		mid = (arr[0] + arr[-1]) // 2
		(l, r) = (0, 0)
		left = []
		right = []
		for i in range(len(arr)):
			if arr[i] <= mid:
				l += arr[i]
				left.append(arr[i])
			else:
				r += arr[i]
				right.append(arr[i])
		dic[l] = 1
		dic[r] = 1
		help(left)
		help(right)
	help(arr)
	return dic
for _ in range(ii1()):
	(n, q) = iia()
	arr = iia()
	arr.sort()
	s = sum(arr)
	dic = solve(arr)
	for i in range(q):
		qi = ii1()
		if qi in dic:
			print('Yes')
		elif qi == s:
			print('Yes')
		else:
			print('No')


import sys, math, itertools, collections, copy
input = sys.stdin.readline

def combine(arr: list, ans: set) -> set:
	ans.add(sum(arr))
	if arr[0] == arr[-1]:
		return ans
	mid = arr[0] + arr[-1] >> 1
	(lo, hi) = (0, len(arr) - 1)
	while lo + 1 < hi:
		m = lo + hi >> 1
		if arr[m] <= mid:
			lo = m
		else:
			hi = m
	(new1, new2) = ([], [])
	for i in range(len(arr)):
		if i <= lo:
			new1.append(arr[i])
		else:
			new2.append(arr[i])
	(s1, s2) = (set(), set())
	s1 = combine(new1, s1)
	s2 = combine(new2, s2)
	ans = ans.union(s1, s2)
	return ans
for _ in range(int(input())):
	(n, q) = map(int, input().split())
	a = [int(x) for x in input().split()]
	a.sort()
	tmp = set()
	ans = combine(a, tmp)
	for i in range(q):
		x = int(input())
		if x in ans:
			print('Yes')
		else:
			print('No')