https://www.acmicpc.net/problem/3649
import sys
def solution():
read = sys.stdin.readline
while True:
try:
x = int(read()) * 10 ** 7
except:
break
n = int(read())
parts = [int(read()) for _ in range(n)]
parts.sort()
if n <= 1:
print('danger')
continue
s = 0
e = n-1
while True:
summ = parts[s] + parts[e]
if summ == x:
possible = True
break
elif summ < x:
s += 1
elif summ > x:
e -= 1
if s == e:
possible = False
break
if possible:
print(f'yes {parts[s]} {parts[e]}')
else:
print('danger')
solution()