Dhiraj loves Chocolates.He loves chocolates so much that he can eat up to $1000$ chocolates a day. But his mom is fed up by this habit of him and decides to take things in her hand.
Its diwali Season and Dhiraj has got a lot of boxes of chocolates and Dhiraj's mom is afraid that dhiraj might eat all boxes of chocolates.
So she told Dhiraj that he can eat only exactly $k$ number of chocolates and dhiraj has to finish all the chocolates in box selected by him and then move on to next box of chocolate.Now Dhiraj is confused that whether he will be able to eat $k$ number of chocolates or not. Since dhiraj is weak at maths,he asks for your help to tell him whether he can eat $k$ number of chocolates or not. 
So given number of chocolates  are $k$ which dhiraj has to eat and the boxes of chocolates each containing some number of chocolates, tell whether dhiraj will be able to eat $k$ number of chocolates or not.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- $k$, representing the number of chocolates dhiraj has to eat.
- the third line contains $N$ representing the no. of boxes of chocolates.
- fourth line contains list of $a[]$ size $N$ specifying the number of chocolates in each Box.

-----Output:-----
- For each testcase, output in a single line answer $0$ or $1$.
- $0$ if dhiraj cant eat $k$ chocolates from given combination and $1$ if he can eat $k$ chocolates from given combination.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq K \leq 10^7$
- $1 \leq  N \leq 800$
- $1 \leq a[i] \leq 10^3$

-----Sample Input:-----
2
20
5
8 7 2 10 5
11
4
6 8 2 10

-----Sample Output:-----
1
0

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def isSubsetSum(arr, n, sum): \n     \n    # The value of subset[i%2][j] will be true  \n    # if there exists a subset of sum j in  \n    # arr[0, 1, ...., i-1] \n    subset = [ [False for j in range(sum + 1)] for i in range(3) ] \n   \n    for i in range(n + 1): \n        for j in range(sum + 1): \n            # A subset with sum 0 is always possible  \n            if (j == 0): \n                subset[i % 2][j] = True\n   \n            # If there exists no element no sum  \n            # is possible  \n            elif (i == 0): \n                subset[i % 2][j] = False\n            elif (arr[i - 1] <= j): \n                subset[i % 2][j] = subset[(i + 1) % 2][j - arr[i - 1]] or subset[(i + 1)  \n                                                                               % 2][j] \n            else: \n                subset[i % 2][j] = subset[(i + 1) % 2][j] \n                  \n    return subset[n % 2][sum]  \n\t\t\n# Driver program to test above function \nfor _ in range(int(input())):\n    k = int(input())\n    n = int(input())\n    a = list(map(int,input().split()))\n    if sum(a) < k or k < min(a):\n        print(0)\n        continue\n    if (isSubsetSum(a, n, k) == True): \n\t    print(1) \n    else: \n\t    print(0)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13293