#define _CRT_SECURE_NO_WARNINGS
//#include <iostream>
#include <cstdio>
//#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <cmath>
//#include <numeric>
//#include <string> 
#include <vector>
//#include <array>
//#include <unordered_map>
//#include <map>
//#include <queue>
//#include <set>
//#include <stack>
//#include <string>

using u = unsigned;

constexpr u N = (u)1e5;

struct node {
    u vis = 0;
    std::vector<u> childs;
};
u n;
node nodes[N];

std::vector<u> ans_way;

bool dfs(u v) {
    nodes[v].vis = 1;
    ans_way.push_back(v);
    for(auto& q : nodes[v].childs) {
        if(ans_way.size() == n && q == 0) return true;
        if(!nodes[q].vis) {
            bool r = dfs(q);
            if(r) return true;
        }
    }
    ans_way.pop_back();
    nodes[v].vis = 0;
    return false;
}

int main() {
    u m;
    scanf("%u%u", &n, &m);
    for(u i = 0, a, b; i < m; i++) scanf("%u%u", &a, &b), nodes[a-1].childs.push_back(b-1);

    bool r = dfs(0);
    puts(r ? "YES" : "NO");
    if(r) {
        for(auto v : ans_way) printf("%u ", v+1);
        puts("1");
    }
}