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(set, n, sum):\r\n    # The value of subset[i][j] will be\r\n    # true if there is a \r\n    # subset of set[0..j-1] with sum equal to i \r\n    subset = ([[False for i in range(sum + 1)]\r\n               for i in range(n + 1)])\r\n\r\n    # If sum is 0, then answer is true  \r\n    for i in range(n + 1):\r\n        subset[i][0] = True\r\n\r\n    # If sum is not 0 and set is empty,  \r\n    # then answer is false  \r\n    for i in range(1, sum + 1):\r\n        subset[0][i] = False\r\n\r\n    # Fill the subset table in botton up manner \r\n    for i in range(1, n + 1):\r\n        for j in range(1, sum + 1):\r\n            if j < set[i - 1]:\r\n                subset[i][j] = subset[i - 1][j]\r\n            if j >= set[i - 1]:\r\n                subset[i][j] = (subset[i - 1][j] or\r\n                                subset[i - 1][j - set[i - 1]])\r\n\r\n                # uncomment this code to print table\r\n    # for i in range(n + 1): \r\n    # for j in range(sum + 1): \r\n    # print(subset[i][j], end =" ") \r\n    # print() \r\n    return subset[n][sum]\r\n\r\nfor _ in range(int(input())):\r\n    K = int(input())\r\n    N = int(input())\r\n    array = list(map(int, input().split()))\r\n    if K > sum(array):\r\n        print(0)\r\n    elif isSubsetSum(array, N , K):\r\n        print(1)\r\n    else:\r\n        print(0)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13255