Chef wants to make a purchase. For this, he needs X gold coins, but he has none at the moment.

Chef has N fixed deposits, the i^{th} of which is worth A_{i} coins. He wants to open the minimum number of these deposits so that he has at least X coins.

You have to tell Chef the minimum number of fixed deposits he must open in order to have X coins, or say that this is impossible.

------ Input Format ------ 

- The first line of input contains a single integer T, denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains two space-separated integers — N and X, as described in the statement.
- The second line of each test case contains N space-separated integers — the i^{th} of which is A_{i}.

------ Output Format ------ 

For each test case, output one line containing the answer — the minimum number of FDs Chef must open to have at least X coins. If it is not possible for him to open FDs such that he has at least X coins, output -1. 

------ Constraints ------ 

$1 ≤ T, A_{i}, N ≤ 100$
$1 ≤ X ≤ 10^{4}$

------ subtasks ------ 

Subtask #1 (100 points): Original constraints

----- Sample Input 1 ------ 
4
4 6
4 3 5 1
3 15
1 5 3
2 5
10 3
4 7
1 2 3 4
----- Sample Output 1 ------ 
2
-1
1
2
----- explanation 1 ------ 
Test case $1$: Chef can open the first and second FDs to get $4 + 3 = 7$ coins, which is more than the $6$ coins he needs. There are other combinations of two FDs giving at least $6$ coins — for example, the first and third (for $4 + 5 = 9$) and third and fourth (for $5 + 1 = 6$), but there is no way to open only one FD and get $6$ or more coins.

Test case $2$: No matter which FDs Chef opens, he cannot have $≥ 15 $ coins, so the answer is $-1$ — even if he opens all of them, he will have only $1 + 5 + 3 = 9$ coins.

Test case $3$: Chef can open the first FD to obtain $10$ coins, which is larger than the $5$ coins he needs.

Test case $4$: Chef can open the third and fourth FDs to get $3 + 4 = 7$ coins, which is enough because he needs $7$ coins.

Source: codechef | Difficulty: EASY


Solutions:
for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	l1 = l[::-1]
	c = 0
	s = 0
	if sum(l1) < x:
		print(-1)
	else:
		for i in range(n):
			if s >= x:
				break
			else:
				s = s + l1[i]
				c = c + 1
		print(c)


t = int(input())
for tc in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))[:n]
	a.sort()
	b = a[::-1]
	r = 0
	for j in range(n):
		if r + b[j] < x:
			r += b[j]
		else:
			print(j + 1)
			break
	if sum(b) < x:
		print(-1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	s = 0
	for i in range(n):
		if s + l[i] < x:
			s = s + l[i]
		else:
			print(i + 1)
			break
	else:
		print(-1)


for _ in range(int(input())):
	(n, l) = map(int, input().split())
	a = [int(x) for x in input().split()]
	a = sorted(a, reverse=True)
	deposit = 0
	ans = -1
	for i in range(n):
		deposit += a[i]
		if deposit >= l:
			ans = i + 1
			break
	print(ans)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	n = [int(a) for a in input().split()]
	m = max(n)
	s = 0
	u = 0
	if m >= b:
		print(1)
	else:
		for j in range(a):
			s = s + n[j]
		if s < b:
			print(-1)
		else:
			for k in range(a):
				m = max(n)
				u = u + max(n)
				if u >= b:
					u = k + 1
					break
				else:
					n.remove(m)
			print(u)


try:
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		l = list(map(int, input().split()))
		c = 0
		d = 0
		l.sort(reverse=True)
		for i in range(a):
			c += l[i]
			if c >= b:
				d += 1
				break
			else:
				d += 1
				if i == a - 1:
					d = -1
		print(d)
except:
	pass


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	lst = sorted(list(map(int, input().split())), reverse=True)
	sm = sum(lst)
	if sm < x:
		print(-1)
	else:
		s = 0
		for i in range(0, n):
			s = s + lst[i]
			if s >= x:
				break
		print(i + 1)


t = int(input())
for ni in range(t):
	(n, x) = map(int, input().split())
	a = [int(i) for i in input().split()]
	a.sort(reverse=True)
	(c, j) = (0, 0)
	for i in a:
		c = c + i
		j = j + 1
		if c >= x:
			print(j)
			break
	if c < x:
		print(-1)


t = int(input())
while t != 0:
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	l = l[::-1]
	s = 0
	for i in l:
		s = s + i
	if x > s:
		print('-1')
	else:
		count = 0
		s = 0
		for i in l:
			s = s + i
			count = count + 1
			if s >= x:
				print(count)
				break
	t = t - 1


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr = sorted(arr, reverse=True)
	ans = 0
	total = 0
	for i in arr:
		if total >= x:
			break
		total += i
		ans += 1
	if total < x:
		print(-1)
	else:
		print(ans)


n = int(input())
for _ in range(n):
	(l, req) = map(int, input().split())
	fixed = list(map(int, input().split()))
	fixed.sort(reverse=True)
	sum = 0
	fla = 0
	count = 0
	for i in fixed:
		sum += i
		count += 1
		if sum >= req:
			fla = 1
			break
	if fla == 1:
		print(count)
	elif fla == 0:
		print(-1)


test_cases = input()
for _ in range(int(test_cases)):
	(total_deposits, gold) = list(map(int, input().strip().split()))
	despoit_worth = list(map(int, input().strip().split()))
	count = 0
	sum_val = 0
	for (index, deposits) in enumerate(sorted(despoit_worth, reverse=True)):
		sum_val += deposits
		if sum_val >= gold:
			print(index + 1)
			break
		elif sum_val < gold and index == len(despoit_worth) - 1:
			print(-1)


tc = int(input())
for _ in range(tc):
	(n, x) = [int(x) for x in input().split(' ')]
	arr = [int(x) for x in input().split(' ')]
	arr.sort(reverse=True)
	has = 0
	i = -1
	while has < x:
		i += 1
		if i == n:
			break
		has += arr[i]
	if i == n:
		print(-1)
	else:
		print(i + 1)


t = int(input())
while t:
	(n, x) = map(int, input().split())
	l = sorted(list(map(int, input().split())))[::-1]
	if sum(l) < x:
		print(-1)
	else:
		for i in range(1, n + 1):
			p = sum(l[0:i])
			if p >= x:
				print(i)
				break
	t -= 1


t = int(input())
while t != 0:
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	s = c = 0
	for k in l:
		s += k
		c += 1
		if s >= x:
			print(c)
			break
	if c == n and s < x:
		print('-1')
	t -= 1


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	(c, p) = (0, 0)
	a.sort()
	a = a[::-1]
	if sum(a) < x:
		p = -1
	else:
		for i in a:
			c += i
			p += 1
			if c >= x:
				break
	print(p)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	if sum(arr) < x:
		print(-1)
	else:
		arr.sort()
		arr.reverse()
		count = 0
		nos = 0
		for i in arr:
			count += i
			nos += 1
			if count >= x:
				print(nos)
				break


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 0
	a.sort(reverse=True)
	for i in range(n):
		count += a[i]
		if count >= x:
			print(i + 1)
			break
	else:
		print(-1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a_sum = sum(a)
	if a_sum < x:
		print(-1)
	elif a_sum == x:
		print(n)
	else:
		a.sort(reverse=True)
		res = 0
		for v in a:
			x -= v
			res += 1
			if x <= 0:
				break
		print(res)


for tc in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	accts = -1
	tot = 0
	for i in range(n):
		tot += a[i]
		if tot >= x:
			accts = i + 1
			break
	print(accts)


a = int(input(''))
for i in range(a):
	(N, X) = [int(x) for x in input('').split()]
	t = [int(x) for x in input('').split()]
	k = list(t)
	k.sort(reverse=True)
	c = 0
	d = 0
	for j in range(N):
		c = c + k[j]
		d = d + 1
		if c >= X:
			print(d)
			break
	else:
		print(-1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = []
	(m, count) = (0, 0)
	if x > sum(l):
		count = -1
	else:
		while True:
			m = max(l)
			l1.append(m)
			l.remove(m)
			if sum(l1) >= x:
				count = count + 1
				break
			else:
				count = count + 1
	print(count)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	b = []
	c = 0
	for i in range(0, len(a)):
		if sum(b) < x:
			b.append(max(a))
			a.remove(max(a))
			c += 1
		else:
			break
	if sum(b) < x:
		print(-1)
	else:
		print(c)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	suma = 0
	deposit = 0
	for value in a:
		deposit += 1
		suma += value
		if suma >= x:
			break
	if suma < x:
		deposit = -1
	print(deposit)


for t in range(int(input())):
	(n, x) = map(int, input().split())
	a = sorted(list(map(int, input().split())))[::-1]
	k = 0
	ans = 0
	while True:
		k += a[0]
		ans += 1
		if k >= x:
			print(ans)
			break
		else:
			a.pop(0)
			if len(a) == 0:
				print(-1)
				break


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	a.reverse()
	(m, i, c) = (0, 0, 0)
	for val in a:
		c += val
		i += 1
		if c >= x:
			m = 1
			break
	print(i if m == 1 else -1)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	a.reverse()
	if max(a) >= x:
		print(1)
	elif sum(a) < x:
		print(-1)
	else:
		d = 0
		i = 0
		while d < x:
			d += a[i]
			i += 1
		print(i)


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	if y > sum(l):
		print(-1)
	else:
		i = c = 0
		while y > 0:
			y = y - l[i]
			c += 1
			i += 1
		print(c)


def Solution(l, n, x):
	l = sorted(l)
	count = 0
	for i in l[::-1]:
		x = x - i
		count = count + 1
		if x <= 0:
			return count
	if x <= 0:
		return count
	return -1
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	print(Solution(l, n, x))


t = input()
for c in range(0, int(t)):
	(n, x) = input().split()
	count = 0
	arr = []
	a = input().split()
	for y in a:
		arr.append(int(y))
	arr.sort()
	x = int(x)
	tracker = int(n) - 1
	while x > 0 and tracker >= 0:
		count = count + 1
		x = x - arr[tracker]
		tracker = tracker - 1
	if tracker < 0 and x > 0:
		print(-1)
	else:
		print(count)


t = int(input())
while t:
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	(sum, c) = (0, 0)
	for i in range(len(a)):
		sum += a[i]
		c += 1
		if sum >= x:
			break
	if sum < x:
		print('-1')
	else:
		print(c)
	t -= 1


t = int(input())
for i in range(0, t):
	(a, b) = input().split()
	c = 0
	d = []
	e = input().split()
	for j in e:
		d.append(int(j))
	d.sort()
	b = int(b)
	r = int(a) - 1
	while b > 0 and r >= 0:
		c = c + 1
		b = b - d[r]
		r = r - 1
	if r < 0 and b > 0:
		print(-1)
	else:
		print(c)


T = int(input())
for i in range(T):
	[n, x] = [int(j) for j in str(input()).split(' ')]
	a = [int(j) for j in str(input()).split(' ')]
	p = 0
	t = 0
	while len(a) > 0 and p < x:
		p = p + max(a)
		a.remove(max(a))
		t += 1
	if p < x:
		print(-1)
	else:
		print(t)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = sorted(l, reverse=True)
	d = 0
	c = 0
	if sum(l) < b:
		print(-1)
	else:
		for j in range(len(l)):
			if c < b:
				c = c + l1[j]
				d += 1
			else:
				break
		print(d)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	a.sort()
	a = a[::-1]
	s = 0
	c = 0
	l = []
	for j in range(n):
		s = s + a[j]
		c = c + 1
		if s >= x:
			l.append(c)
			break
	if l == []:
		print(-1)
	else:
		print(l[0])


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	inp = list(map(int, input().split()))
	inp.sort(reverse=True)
	s = 0
	cnt = 0
	if sum(inp) < x:
		print('-1')
	else:
		for i in range(n):
			s += inp[i]
			cnt += 1
			if s >= x:
				break
		print(cnt)


for i in range(int(input())):
	(N, X) = map(int, input().split())
	L = list(map(int, input().split()))
	L.sort()
	D = 0
	K = 0
	if sum(L) < X:
		print(-1)
	else:
		for _ in range(len(L)):
			if D < X:
				D += L[len(L) - _ - 1]
				K += 1
			else:
				break
		print(K)


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	A = list(map(int, input().split()))
	if sum(A) < X:
		print('-1')
	elif max(A) >= X:
		print('1')
	else:
		A.sort(reverse=True)
		count = 0
		sum1 = 0
		for i in range(len(A)):
			if sum1 < X:
				sum1 += A[i]
				count += 1
		print(count)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	li = list(map(int, input().split()))
	li.sort(reverse=True)
	ans = 0
	count = 0
	found = 0
	for i in li:
		ans += i
		count += 1
		if ans >= b:
			print(count)
			found = -1
			break
	if found != -1:
		print(-1)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	if sum(a) < x:
		print(-1)
	else:
		a.sort(reverse=True)
		sum_fd = 0
		cnt = 0
		for j in range(n):
			if sum_fd < x:
				sum_fd += a[j]
				cnt += 1
		print(cnt)


t = int(input())
for i in range(t):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	a = 0
	for j in range(1, n + 1):
		if sum(l[0:j]) >= x:
			print(j)
			a = 1
			break
	if a == 0:
		print(-1)


tests = int(input())
for i in range(tests):
	(n, x) = map(int, input().split())
	arr = list(map(int, input().split()))
	if sum(arr) < x:
		print(-1)
		continue
	used_indexes_set = set()
	ans = 0
	while x > 0:
		maximum = 0
		maximum_index = -1
		for j in range(n):
			if j not in used_indexes_set and arr[j] > maximum:
				maximum = arr[j]
				maximum_index = j
		x -= maximum
		used_indexes_set.add(maximum_index)
		ans += 1
	print(ans)


t = int(input())
for i in range(t):
	(n, c) = map(int, input().split())
	A = list(map(int, input().split()))
	A.sort(reverse=True)
	f = 0
	fc = 0
	g = 0
	if sum(A) < c:
		print(-1)
	else:
		while fc == 0:
			if c - A[g] <= 0:
				f += 1
				fc += 1
				print(f)
			else:
				c -= A[g]
				g += 1
				f += 1


for test in range(int(input())):
	(n, x) = map(int, input().split())
	arr = [int(char) for char in input().split()]
	arr.sort()
	c = 0
	l = 0
	for i in range(n):
		c = c + arr[-i - 1]
		if c >= x:
			print(i + 1)
			l = 1
			break
	if l == 0:
		print(-1)


for t in range(int(input())):
	[n, x] = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	if sum(a) < x:
		print(-1)
		continue
	elif sum(a) == x:
		print(n)
		continue
	a.sort(reverse=True)
	ans = 0
	for i in a:
		if i >= x:
			ans += 1
			break
		else:
			x = x - i
			ans += 1
	print(ans)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	sum1 = 0
	c = 0
	flag = 0
	for i in range(n):
		sum1 += a[i]
		c += 1
		if sum1 >= x:
			flag = 1
			break
	if flag:
		print(c)
	else:
		print('-1')


def check(a):
	c = 0
	s = 0
	a.sort(reverse=True)
	for i in a:
		s += i
		c += 1
		if s >= x:
			return c
	return -1
for _ in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	print(check(a))


t = int(input())
for z in range(t):
	(n, x) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	arr.sort()
	arr.reverse()
	s = 0
	i = 0
	while s < x:
		s = s + arr[i]
		i = i + 1
		if i == n:
			break
	if sum(arr) < x:
		print(-1)
	else:
		print(i)


for t in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	f = c = s = 0
	l.sort()
	l.reverse()
	for i in range(n):
		s = sum(l[0:i + 1])
		c = i + 1
		if s >= x:
			f = 1
			break
	if f == 0:
		print('-1')
	else:
		print(c)


for t in range(int(input())):
	nx = input().split()
	fd = int(nx[0])
	x = int(nx[1])
	values = list(map(int, input().split()))
	values.sort(reverse=True)
	totalfd = sum(values)
	if x > totalfd:
		print(-1)
		continue
	else:
		pass
	needed = 0
	current = 0
	for i in values:
		current = current + i
		needed = needed + 1
		if current >= x:
			break
		else:
			pass
	print(needed)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort(reverse=True)
	s = 0
	for i in range(a):
		s += l[i]
		if s >= b:
			print(i + 1)
			break
	else:
		print(-1)


def allsum(l):
	s = 0
	for i in l:
		s += i
	return s
for i in range(int(input())):
	(n, x) = map(int, input().split())
	l = list(map(int, input().split()))
	l.sort()
	l.reverse()
	if allsum(l) < x:
		print(-1)
	else:
		s = 0
		i = 0
		ans = 0
		while s < x:
			s += l[i]
			ans += 1
			i += 1
		print(ans)


T = int(input())
for i in range(T):
	(a, b) = map(int, input().split())
	lis1 = list(map(int, input().split()))
	lis1.sort()
	lis1.reverse()
	sumer = 0
	count = 0
	for v in lis1:
		sumer += v
		count += 1
		if sumer >= b:
			break
	if sumer < b:
		print(-1)
	else:
		print(count)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	li = list(map(int, input().split()))[:n]
	cnt = 0
	sum = 0
	while sum < x and len(li) > 0:
		sum += max(li)
		li.remove(max(li))
		cnt += 1
	if sum >= x:
		print(cnt)
	else:
		print(-1)


t = int(input())
for j in range(t):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	c.sort()
	c = c[::-1]
	sum = 0
	u = 0
	for i in range(a):
		sum += c[i]
		u += 1
		if sum >= b:
			break
	if sum < b:
		print(-1)
	else:
		print(u)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x = list(map(int, input().split()))
	x.sort()
	sum = 0
	count = -1
	for j in range(a - 1, -1, -1):
		sum = sum + x[j]
		if sum >= b:
			count = a - j
			break
	print(count)


t = int(input())
while t > 0:
	(n, ele) = input().split()
	n = int(n)
	ele = int(ele)
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	(count, sum) = (-1, 0)
	for i in range(n):
		sum += arr[i]
		if sum >= ele:
			count = i + 1
			break
	print(count)
	t -= 1


class Solution:

	def minfd(self, n, arr, x):
		if sum(arr) < x:
			return -1
		else:
			co = 0
			arr.sort(reverse=True)
			for i in range(n):
				if x > 0:
					co += 1
					x = x - arr[i]
				else:
					break
			return co
tc = int(input())
while tc > 0:
	(n, x) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	Sol = Solution()
	print(Sol.minfd(n, arr, x))
	tc -= 1


t = int(input())
for i in range(t):
	j = 0
	l = 0
	(n, x) = map(int, input().split())
	fix = list(map(int, input().split()))
	fix.sort()
	fix.reverse()
	for i in fix:
		l = l + 1
		j = j + i
		if j >= x:
			print(l)
			break
	if j < x:
		print(-1)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	lst = list(map(int, input().split()))
	lst.sort(reverse=True)
	res = 0
	count = 0
	if sum(lst) < x:
		print('-1')
	else:
		for j in range(n):
			res += lst[j]
			count += 1
			if res >= x:
				print(count)
				break


for _ in range(int(input())):
	cnt = 0
	(n, x) = map(int, input().split())
	y = input().split()
	for i in range(0, len(y)):
		y[i] = int(y[i])
	y.sort(reverse=True)
	z = sum(y)
	if x > z:
		print('-1')
	s = 0
	for j in y:
		s += j
		cnt += 1
		if s >= x:
			print(cnt)
			break


failure = -1

def solve(*args):
	(n, x, a) = args
	if sum(a) < x:
		return failure
	ans = 0
	while len(a) > 0:
		ans += 1
		x -= a.pop()
		if x <= 0:
			return ans

def do_codechef():
	for t in range(int(input())):
		(n, x) = map(int, input().split(' '))
		a = sorted(list(map(int, input().split(' '))))
		print(solve(n, x, a))
do_codechef()
exit()


for i in range(int(input())):
	(n, x) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort(reverse=True)
	s = 0
	b = -1
	for i in range(n):
		s += a[i]
		if s >= x:
			b = i + 1
			break
	print(b)


t = int(input())
while t:
	(n, x) = map(int, input().split())
	arr = []
	arr = list(map(int, input().split()))
	arr.sort(reverse=True)
	sum = arr[0]
	count = 1
	i = 1
	while sum < x and i < n:
		sum += arr[i]
		count += 1
		i += 1
	if sum < x:
		print('-1')
	else:
		print(count)
	t -= 1


t = int(input())
while t:
	(n, k) = map(int, input().split())
	li = list(map(int, input().split()))
	li = sorted(li)[::-1]
	s = 0
	ct = 0
	for i in range(n):
		s += li[i]
		ct += 1
		if s >= k:
			break
	if s >= k:
		print(ct)
	else:
		print(-1)
	t -= 1


t = int(input())
for i in range(t):
	(n, x) = input().split()
	(n, x) = (int(n), int(x))
	list1 = [int(item) for item in input().split()]
	list1.sort(reverse=True)
	(c, s) = (0, 0)
	for j in list1:
		s += j
		c += 1
		if s >= x:
			break
	if s >= x:
		print(c)
	else:
		print(-1)