s, n = map(int,input().split())
coll = []
for i in range(n):
x, y = map(int,input().split())
coll.append([x,y,0])
coll = sorted(coll,key=lambda x:x[1])
found = 1
kills = 0
while(found):
found = 0
for i in range(n-1,-1,-1):
if coll[i][0]<s and coll[i][2] is 0:
if coll[i][1] is 0:
s -= coll[i][0]
else:
s += coll[i][1]
coll[i][2] = 1
kills+=1
found = 1
break
if kills is n:
print ('YES')
else:
print ('NO')
cywgbiA9IG1hcChpbnQsaW5wdXQoKS5zcGxpdCgpKQpjb2xsID0gW10KZm9yIGkgaW4gcmFuZ2Uobik6CiAgICB4LCB5ID0gbWFwKGludCxpbnB1dCgpLnNwbGl0KCkpCiAgICBjb2xsLmFwcGVuZChbeCx5LDBdKQoKY29sbCA9IHNvcnRlZChjb2xsLGtleT1sYW1iZGEgeDp4WzFdKQoKZm91bmQgPSAxCmtpbGxzID0gMAoKd2hpbGUoZm91bmQpOgogICAgZm91bmQgPSAwCiAgICBmb3IgaSBpbiByYW5nZShuLTEsLTEsLTEpOgogICAgICAgIGlmIGNvbGxbaV1bMF08cyBhbmQgY29sbFtpXVsyXSBpcyAwOgogICAgICAgICAgICBpZiBjb2xsW2ldWzFdIGlzIDA6CiAgICAgICAgICAgICAgICBzIC09IGNvbGxbaV1bMF0KICAgICAgICAgICAgZWxzZToKICAgICAgICAgICAgICAgIHMgKz0gY29sbFtpXVsxXQogICAgICAgICAgICBjb2xsW2ldWzJdID0gMQogICAgICAgICAgICBraWxscys9MQogICAgICAgICAgICBmb3VuZCA9IDEKICAgICAgICAgICAgYnJlYWsKCmlmIGtpbGxzIGlzIG46CiAgICBwcmludCAoJ1lFUycpCmVsc2U6CiAgICBwcmludCAoJ05PJyk=