#include <bits/stdc++.h>
using namespace std;
#define DFS_RETURN(RETURN_VAL) {cnt--; return (RETURN_VAL);}

int n, m;
std::vector <std::vector <int>> graph;
std::vector <bool> visited;
std::vector <int> nexts;

bool dfs(int vertex) {
    static int cnt = 0;

    cnt++;
    if (vertex == 0 && cnt == n + 1) DFS_RETURN(true);
    if (visited[vertex]) DFS_RETURN(false);
    visited[vertex] = true;

    //cout << vertex << ": ";
    for (int i : graph[vertex]) {
        //cout << "[" << i << "]";
        nexts[vertex] = i;
        if (dfs(i)) DFS_RETURN(true);
    }
    //cout << endl;

    visited[vertex] = false;
    DFS_RETURN(false);
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    graph.assign(n, {{}});
    for (auto& i : graph) {
        i.assign(0, {});
    }
    visited.assign(n, {false});
    nexts.assign(n, {-1});
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
    }
    if (dfs(0)) {
        cout << "YES" << endl;
        int cur = 0;
        do {
            cout << cur + 1 << ' ';
            cur = nexts[cur];
        } while (cur != 0);
        cout << "1" << endl;
    } else
        cout << "NO" << endl;
}
