#include <iostream>
#include <vector>

using namespace std;

vector<vector<int>> graph;
vector<int> used, path;
int flag, n, m;


void dfs(int v) {
    used[v] = 1;
    path.push_back(v);
    for (int i = 0; i < graph[v].size(); i++) {
        int to = graph[v][i];
        if (to == 1 && path.size() == n) {
            flag = 1;
            path.push_back(to);
            return;
        } else if (used[to] == 0) dfs(to);
    }
    if (flag == 1) return;
    used[v] = 0;
    path.pop_back();
}

int main() {
    int v1, v2;
    cin >> n >> m;
    graph.resize(n + 1);
    used.resize(n + 1, 0);
    for (int i = 0; i < m; i++) {
        cin >> v1 >> v2;
        graph[v1].push_back(v2);
    }

    dfs(1);

    if (flag == 1) {
        cout << "YES" << endl;
        for (int i: path) cout << i << " ";
        cout << endl;
    } else cout << "NO" << endl;

    return 0;
}