#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;

#define sz(x) (int)(x).size()
#define ins insert
#define pb push_back
#define ff first
#define ss second
#define bust ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl '\n'
ll n, m;
bool used[100007];
vvl g;
vl res;
double start;

bool dfs(ll v, ll cnt){
    if((clock() - start) / CLOCKS_PER_SEC >= 0.99999999999999999999999){
        res.clear();
        return 2;
    }

    if(v == 0 && cnt == n){
        res.pb(0);
        return true;
    }
    used[v] = 1;
    for(auto to : g[v]){
        if(!used[to]){
            ll tek = dfs(to, cnt+1);
            if(tek){
                res.pb(v);
                return true;
            }
        }
    }
    used[v] = false;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    start = clock();
    cin >> n >> m;
    g.resize(n);
    for(int i = 0; i < m; ++i){
        ll v, to;
        cin >> v >> to;
        --v;
        --to;
        g[v].pb(to);
    }
    for(auto to : g[0]){
        if(!used[to]){
            if(dfs(to, 1)){
                res.pb(0);
                break;
            }
        }
    }
    if(res.size() > 1){
        reverse(res.begin(), res.end());
        cout << "YES\n";
        for(auto e: res){
            cout << e+1 << " ";
        }
    }
    else cout << "NO\n";
    return 0;
}
