a, b = map(int, input().split())
def fs(steps, g, road, n, r):
    global stopp
    steps = steps + 1
    road.append(n)
    for x in g[n]:
        if x not in road:
            fs(steps, g, road, x, r)
            if stopp == 0:
                road.pop(len(road)-1)
        elif x == '1' and len(road) == r:
            cop = ' '.join(road)
            cop = cop + ' 1'
            print('YES')
            print(cop)
            stopp = 1
            break
stopp = 0
st = 0
steps = 1
ways = {}
for i in range(a):
    ways[str(i+1)] = []
for i in range(b):
    n, c = map(str, input().split())
    ways[n].append(c)
for i in ways:
    if ways[str(i)] == []:
        print('NO')
        st = 1
        break
if st == 0 :
        fs(steps, ways, [], '1', len(ways))
        if stopp == 0:
            print('NO')
