#pragma GCC optimize("O3")
#pragma GCC optimize("unrol-loops")
#include <bits/stdc++.h>
using namespace std;

int n, t;
vector <int> g[105000];
int has_edge[105000] = {};
bool vis[105000];
map <int, int> way;
vector <int> get_way;
bool findd = 0;

inline void dfs(int v, int cnt) {
    vis[v] = 1;
    for (auto i : g[v]) {
        if (findd)
            return;
        if (!vis[i])
            way[i] = v, dfs(i, cnt + 1);
        else
        if (i == 1 && cnt == n) {
            t = v;
            findd = 1;
            return;
        }
    }
    vis[v] = 0;
}

inline void get(int v) {
    get_way.push_back(v);
    if (v != 1)
        get(way[v]);
}

int main() {
    int m;
    cin >> n >> m;
    if (m < n) {
        cout << "NO";
        return 0;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        g[a].push_back(b);
        has_edge[b] = 1;
    }
    for (int i = 1; i <= n; i++)
        if (g[i].size() == 0 || has_edge[i] == 0) {
            cout << "NO";
            return 0;
        }
    dfs(1, 1);
    if (!findd) {
        cout << "NO";
        return 0;
    }
    cout << "YES\n";
    get(t);
    for (int i = get_way.size() - 1; i > -1; i--)
        printf("%d ", get_way[i]);
    cout << 1;
    return 0;
}
