n, m = map(int, input().split())
roads = {}
# next you need to parse the input. input string is in format is a, b. a is the start city, b is the end city.
for i in range(m):
    a, b = map(int, input().split())
    if a in roads:
        roads[a].append(b)
    else:
        roads[a] = [b]



def parse(start, current, first = True, visited = []):
    if start == current and not first:
        return True, None
    roads_to = roads[current]
    for road in roads_to:
        if road not in visited:
            visited.append(road)
            ret, road_ = parse(start, road, False, visited)
            visited_is_full = True
            for k in roads:
                if k not in visited:
                    visited_is_full = False
                    break
            if ret and visited_is_full:
                return True, [road] + road_ if road_ else [road]  
            visited.pop()
    return False, None

ret, road = parse(1, 1)
if ret:
    print("YES")
    print(1, *road)
else:
    print("NO")