Untitled

mail@pastecode.io avatar
unknown
python
a year ago
475 B
4
Indexable
Never
vol = int(input())
to_deliver = int(input())

goods = []

ans = False

for i in range(to_deliver):
    goods.append(int(input()))

if to_deliver > 1:
    for i in range(to_deliver):
        for j in range(i+1, to_deliver):
            if goods[i] + goods[j] <= vol:
                ans = True
                break
        if ans:
            break
else:
    if goods[0] > vol:
        ans = False
    else:
        ans = True

if ans:
    print("Yes")
else:
    print("No")