import sys
input = sys.stdin.readline
sys.setrecursionlimit(944533)
def dfs(i, used, ans):
    if i not in d.keys():
        print('NO')
        exit()
    used.add(i)
    ans.append(i)
    if len(ans) == n and 1 in d[i]:
            print('YES')
            ans.append(1)
            print(*ans)
            exit()
    for j in d[i]:
        if j not in used:
            dfs(j, used.copy(), ans[:])


n, m = map(int, input().split())
d = {}
for i in range(m):
    a, b = map(int, input().split())
    if a in d:
        d[a].add(b)
    else:
        d[a] = set([b])
if len(d) != n:
    print('NO')
    exit()
dfs(1, set(), [])
print('NO')

