You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.

You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.

For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of size $32$ into two parts of size $16$, and then divide the box of size $16$. So you can fill the bag with boxes of size $1$, $1$ and $8$.

Calculate the minimum number of divisions required to fill the bag of size $n$.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases.

The first line of each test case contains two integers $n$ and $m$ ($1 \le n \le 10^{18}, 1 \le m \le 10^5$) — the size of bag and the number of boxes, respectively.

The second line of each test case contains $m$ integers $a_1, a_2, \dots , a_m$ ($1 \le a_i \le 10^9$) — the sizes of boxes. It is guaranteed that each $a_i$ is a power of two.

It is also guaranteed that sum of all $m$ over all test cases does not exceed $10^5$.


-----Output-----

For each test case print one integer — the minimum number of divisions required to fill the bag of size $n$ (or $-1$, if it is impossible).


-----Example-----
Input
3
10 3
1 32 1
23 4
16 1 4 1
20 5
2 1 16 1 8

Output
2
-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 = 'import sys\nimport math\nfrom collections import defaultdict\nfrom collections import deque\nfrom itertools import combinations\nfrom itertools import permutations\ninput = lambda : sys.stdin.readline().rstrip()\nread = lambda : list(map(int, input().split()))\ngo = lambda : 1/0\ndef write(*args, sep="\\n"):\n  for i in args:\n    sys.stdout.write("{}{}".format(i, sep))\nINF = float(\'inf\')\nMOD = int(1e9 + 7)\nYES = "YES"\nNO = -1\n\nfor _ in range(int(input())):\n  try:\n    n, m = read()\n    arr = read()\n    x = [0] * 65\n    \n    if sum(arr) < n:\n      print(NO)\n      go()\n  \n    for i in arr:\n      x[int(math.log2(i))] += 1\n    \n    ans = 0\n    for i in range(65):\n      if (1 << i) & n:\n        if x[i] != 0:\n          x[i] -= 1\n          continue \n\n        total = 0\n        for j in range(i):\n          total += (1 << j) * x[j]\n        \n        if total >= (1 << i):\n          temp = 1 << i \n          for j in reversed(range(i)):\n            while temp - (1 << j) >= 0 and x[j] > 0:\n              temp -= 1 << j \n              x[j] -= 1\n          continue \n        \n        j = i\n        while j < 65 and x[j] == 0:\n          j += 1\n        if j == 65:\n          print(NO)\n          go() \n        else:\n          x[j] -= 1\n          for k in range(i, j):\n            x[k] += 1\n          ans += (j - i)\n    \n    print(ans)\n\n\n  except ZeroDivisionError:\n    continue\n\n  except Exception as e:\n    print(e)\n    continue'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15621