#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N = 1e5 + 30;
vector < int > g[N];
int d[N];

void dfs (int v) {
    d[v] = 1;
    for (int to : g[v])
        if (!d[to])
            dfs (to);
    return ;
}

int check (int v, int w) {
    for (int to : g[v]) {
        if (to == w) return 1;
        if (!d[to]) {
            if (check (to, w))
                return 1;
        }
    }
    return 0;
}

int main()
{
    ios_base::sync_with_stdio (0);
    cin.tie (0);
    cout.tie (0);
    int n, m;
    cin >> n >> m;
    fill (d, d + n, 0);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back (v - 1);
    }
    dfs (0);
    for (int i = 0; i < n; ++i) {
        if (d[i] != 1) {
            cout << "NO\n";
            return 0;
        }
    }
    fill (d, d + n, 0);
    vector < int > ans ;
    int v = 0;
    for (int i = 0; i < n; ++i) {
        if (i && v == 0) {
            cout << "NO\n";
            return 0;
        }
        d[v] = 1;
        ans.push_back (v + 1);
        int nxt = g[v][0];
        for (int i = 1; i < g[v].size(); ++i) {
            if (check (g[v][i], nxt))
                nxt = g[v][i];
        }
        v = nxt;
    }
    cout << "YES\n";
    ans.push_back (1);
    for (int i : ans) cout << i << " ";
    cout << "\n";
    return 0;
}
