#include <bits/stdc++.h>
#define pb push_back
using namespace std;
vector<int> v[100005];
vector<int> p;
int used[100005], dist[100005];
int n, m, k = 0;
void dfs(int s) {
    used[s]++;
    k++;
    if (k > m + 5) {
        return;
    }
    if (dist[s] == n - 1) {
        for (int i = 0; i < v[s].size(); i++) {
            if (v[s][i] == 1) {
                p.pb(1);
                dist[1] = n;
            }
        }
    }
    else {
        for (int i = 0; i < v[s].size(); i++) {
            int h = v[s][i];
            if (used[h] == 0 && !dist[1]) {
                dist[h] = dist[s] + 1;
                dfs(h);
            }
        }
    }
    
    if (dist[1] == 0) {
        used[s] = 0;
    }
    else {
        p.pb(s);
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        v[a].pb(b);
    }
    dist[1] = 0;
    dfs(1);
    if (dist[1] != n) {
        cout << "NO";
    }
    else {
        cout << "YES\n";
        for (int i = p.size() - 1; i >= 0; i--) {
            cout << p[i] << " ";
        }
    }
}
