def dfs(i, used, ans):
    used.add(i)
    ans.append(i)
    if len(ans) == n:
        if 1 in d[i]:
            print('YES')
            ans.append(1)
            print(*ans)
            exit()
        else:
            return
    f = 1
    for j in d[i]:
        if j not in used:
            f = 0
            dfs(j, used.copy(), ans[:])
    if f:
        return


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])
dfs(1, set(), [])

