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 = [1]
while path:
    if s[path[-1]]:
        vert = s[path[-1]].pop()
        if vert not in path:
            path.append(vert)
    else:
        path = []
        break
    if len(path) == n:
        break
if path and path[0] in s[path[-1]]:
    print("YES")
    print(*(path+[path[0]]))
else:
    print("NO")