A Little Elephant and his friends from the Zoo of Lviv like candies very much.

There are N elephants in the Zoo. The elephant with number K (1 ≤ K ≤ N) will be happy if he receives at least A_{K} candies. There are C candies in all in the Zoo.

The Zoo staff is interested in knowing whether it is possible to make all the N elephants happy by giving each elephant at least as many candies as he wants, that is, the K^{th} elephant should receive at least A_{K} candies. Each candy can be given to only one elephant. Print Yes if it is possible and No otherwise.

------ Input ------ 

The first line of the input file contains an integer T, the number of test cases. T test cases follow. Each test case consists of exactly 2 lines. The first line of each test case contains two space separated integers N and C, the total number of elephants and the total number of candies in the Zoo respectively. The second line contains N space separated integers A_{1}, A_{2}, ..., A_{N}.

------ Output ------ 

For each test case output exactly one line containing the string Yes if it possible to make all elephants happy and the string No otherwise. Output is case sensitive. So do not print YES or yes.

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

1 ≤ T ≤ 1000
1 ≤ N ≤ 100
1 ≤ C ≤ 10^{9}
1 ≤ A_{K} ≤ 10000, for K = 1, 2, ..., N

----- Sample Input 1 ------ 
2
2 3
1 1
3 7
4 2 2
----- Sample Output 1 ------ 
Yes
No
----- explanation 1 ------ 
Case 1. We can give one candy to the first elephant and two candies to the second elephant and make them both happy. Hence the answer is Yes. Alternatively we can give one candy to each elephant and left one candy for ourselves but they again will be happy.

Case 2. Even if we give four candies to the first elephant and two candies to the second elephant we will have only one candy left and can not make last elephant happy since he needs two candies for his happiness. Hence the answer is No.

Source: codechef | Difficulty: EASY
Tags: Data structures


Solutions:
for i in range(int(input())):
	x = list(map(int, input().split()))
	v = list(map(int, input().split()))
	c = x[1]
	for i in v:
		c = c - i
	if c >= 0:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(n, c) = map(int, input().split())
	l = list(map(int, input().split()))
	if sum(l) > c:
		print('No')
	else:
		print('Yes')


t = int(input())
for tc in range(t):
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	if sum(a) <= c:
		print('Yes')
	else:
		print('No')


T = int(input())

def justice(N, C):
	d = list(map(int, input('').strip().split()))
	if sum(d) > C:
		print('No')
	else:
		print('Yes')
for i in range(T):
	(N, C) = map(int, input().split())
	justice(N, C)


for t in range(int(input())):
	(n, c) = map(int, input().split(' '))
	candies = list(map(int, input().split(' ')))
	totcand = sum(candies)
	if c >= totcand:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	(N, C) = map(eval, input().split())
	need = list(map(eval, input().split()))
	if sum(need) <= C:
		print('Yes')
	else:
		print('No')
	t -= 1


t = int(input())
for _ in range(t):
	f = list(map(int, input().split()))
	(n, c) = (f[0], f[1])
	a = list(map(int, input().split()))
	if sum(a) <= c:
		print('Yes')
	else:
		print('No')


T = int(input())
for _ in range(T):
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	m = sum(a)
	if m <= c:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(n, c) = map(int, input().split())
	s = sum(list(map(int, input().split())))
	print((c >= s) * 'Yes' + 'No' * (c < s))


for _ in range(int(input())):
	(N, C) = map(int, input().split())
	A = list(map(int, input().split()))
	Required_candies = 0
	for i in range(len(A)):
		Required_candies = Required_candies + A[i]
	if Required_candies <= C:
		print('Yes')
	else:
		print('No')


import math
T = int(input())
for _ in range(T):
	(n, c) = map(int, input().split())
	l = list(map(int, input().split()))
	if sum(l) <= c:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l1 = list(map(int, input().split()))
	if sum(l1) <= k:
		print('Yes')
	else:
		print('No')


try:
	test_cases = int(input())
	while test_cases > 0:
		(n, c) = map(int, input().split())
		list_ = list(map(int, input().split()))
		sum = 0
		for i in list_:
			sum += i
		if sum <= c:
			print('Yes')
		else:
			print('No')
		test_cases -= 1
except EOFError as e:
	pass


T = int(input())
for i in range(T):
	(N, C) = map(int, input().split())
	A = list(map(int, input().split()))
	k = sum(A)
	if k <= C:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, c) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	sm = sum(a)
	if sm > c:
		print('No')
	else:
		print('Yes')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	if sum(c) <= b:
		print('Yes')
	else:
		print('No')


T = int(input())
for i in range(T):
	(n, c) = list(map(int, input().split()))
	N = list(map(int, input().split()))
	x = sum(N)
	if x <= c:
		print('Yes')
	else:
		print('No')


t = int(input())
a = []
for i in range(t):
	(n, c) = list(map(int, input().split()))
	temp = list(map(int, input().split()))
	for j in range(n):
		c -= temp[j]
	if c < 0:
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	l2 = list(map(int, input().split()))
	if sum(l2) <= m:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(N, C) = map(int, input().split())
	li = list(map(int, input().split()))
	s = sum(li)
	if s <= C:
		print('Yes')
	else:
		print('No')


a = int(input())
for i in range(a):
	(N, C) = map(int, input().split(' '))
	L = list(map(int, input().split(' ')))
	if sum(L) <= C:
		print('Yes')
	else:
		print('No')


def main():
	t = int(input().strip())
	for i in range(t):
		(n, c) = map(int, input().strip().split())
		a = list(map(int, input().strip().split()))
		if sum(a) <= c:
			print('Yes')
		else:
			print('No')
main()


import os, sys, io, math
from re import *
from math import *
from array import *
from heapq import *
from bisect import *
from functools import *
from itertools import *
from statistics import *
from collections import *
I = lambda : [*map(int, sys.stdin.readline().split())]
IP = lambda : map(int, input().split())
IS = lambda : input()
IN = lambda : int(input())
IF = lambda : float(input())
for _ in range(IN()):
	(n, r) = IP()
	l = I()
	print('Yes' if sum(l) <= r else 'No')


t = int(input())
for i in range(t):
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	sum = 0
	for x in range(n):
		sum += a[x]
	if sum > c:
		print('No')
	else:
		print('Yes')


for _ in range(int(input())):
	(N, C) = map(int, input().split())
	A = list(map(int, input().split()))
	print('Yes' if sum(A) <= C else 'No')


t = int(input())
for _ in range(t):
	(n, c) = map(int, input().split())
	ar = list(map(int, input().split()))
	for v in ar:
		c -= v
	if c >= 0:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, c) = tuple(map(int, input().split()))
	l = list(map(int, input().split()))
	if sum(l) <= c:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	(te, tc) = map(int, input().split())
	el = list(map(int, input().split()))
	print('Yes' if sum(el) <= tc else 'No')


T = int(input())
for t in range(T):
	(N, C) = map(int, input().split(' '))
	array = list(map(int, input().split(' ')))
	print('Yes' if sum(array) <= C else 'No')


for t in range(int(input())):
	(n, c) = map(int, input().split())
	a = list(map(int, input().split()))
	total = 0
	for candy in range(n):
		total = total + a[candy]
	if total <= c:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(n, c) = map(int, input().split())
	li = list(map(int, input().split()))
	s = sum(li)
	if c >= s:
		print('Yes')
	else:
		print('No')


inp = int(input())
for _ in range(inp):
	(ai, bi) = map(int, input().split())
	arr = list(map(int, input().split()))
	empty = sum(arr)
	if empty <= bi:
		print('Yes')
	else:
		print('No')


T = int(input())
for test_case in range(T):
	(N, C) = (int(_) for _ in input().split())
	A = [int(_) for _ in input().split()]
	print('Yes' if sum(A) <= C else 'No')


n = int(input())
for i in range(n):
	(n, t) = map(int, input().split())
	left = t
	l = [int(x) for x in input().split()]
	flag = True
	for i in range(n):
		if left - l[i] < 0:
			flag = False
		else:
			left -= l[i]
	if flag:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(N, candies) = map(int, input().split())
	clist = list(map(int, input().split()))
	sumc = sum(clist)
	if sumc <= candies:
		print('Yes')
	else:
		print('No')


for i in range(int(input())):
	b = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	if sum(a) <= b[1]:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(x, c) = map(int, input().split())
	a = list(map(int, input().split()))
	y = sum(a)
	if y <= c:
		print('Yes')
	else:
		print('No')


goals = int(input())
for distractions in range(goals):
	(wife, aim) = map(int, input().split())
	life = list(map(int, input().split()))
	if sum(life) <= aim:
		print('Yes')
	else:
		print('No')


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	e = list(map(int, input().split()))
	s = 0
	for i in range(0, a):
		s = s + e[i]
	if s <= b:
		print('Yes')
	else:
		print('No')
	t = t - 1


T = int(input())
for i in range(T):
	(N, C) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	B = 0
	for i in range(len(A)):
		B += A[i]
	if C >= B:
		print('Yes')
	else:
		print('No')


t = int(input())
while t > 0:
	(n, c) = list(map(int, input().split()))
	lst = list(map(int, input().split()))
	k = sum(lst)
	if k <= c:
		print('Yes')
	else:
		print('No')
	t -= 1


c = int(input())
while c > 0:
	(n, a) = map(int, input().split())
	b = list(map(int, input().split()))
	s = 0
	for i in b:
		s += i
	if s > a:
		print('No')
	else:
		print('Yes')
	c -= 1


n = int(input())
for z in range(n):
	(x, z) = list(map(int, input().split()))
	y = list(map(int, input().split()))
	count = 0
	for i in range(x):
		count = count + y[i]
	if count <= z:
		print('Yes')
	else:
		print('No')