def ham(start, n, graph):
    res = [start]
    while res:
        if graph[res[-1]]:
            vert = graph[res[-1]].pop()
            if vert not in res:
                res.append(vert)
        else:
            del graph[res[-1]]
            res.pop()
        if len(res) == n:
            break
    return res
n, m = map(int, input().split())
s = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    s[a].append(b)
path = ham(1, n, s)
if path[0] in s[path[-1]]:
    print("YES")
    print(*(path+[path[0]]))
else:
    print("NO")