#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vi = vector<int>;
using pii = pair<ll, ll>;
using vvi = vector<vi>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vb = vector<bool>;

void dfs(int n, vvi& g, vb used, vi way, int v, int start){
    if(v!=start)used[v] = 1;
    way.push_back(v);

    //for(auto i : way) cout<<i<<' ';
    //cout<<endl;

    for(auto to : g[v]) {
       if(!used[to]) {
           if(to == start && way.size()==n) {
               cout<<"YES\n";
               for(auto i : way) cout<<i<<' ';
               cout<<start;
               exit(0);
           }
           
           dfs(n, g, used, way, to, start);
       }
    }
}
void dfss(vvi& g, vb& used, int v, int st){
    if(v!=st)used[v]=1;
    for(auto to : g[v]) if(!used[to]) dfss(g, used, to, st+1);
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	int n, m;
    cin>>n>>m;
    vvi g(n+1);
    for(int i=0; i<m; i++){
        int a, b;
        cin>>a>>b;
        g[a].push_back(b);
    }
    bool f = 0;
    /*for(int i=1; i<=n; i++){
        vb used(n+1, 0);
        vi way;
        dfs(n, g, used, way, i, i);
    }*/
    vb usedd(n+1, 0);
    dfss(g, usedd, 1, 1);
    for(int i=1; i<=n; i++){
        if(!usedd[i]){
            cout<<"NO";
            exit(0);
        }
    }

    vb used(n+1, 0);
    vi way(0,0);
    dfs(n, g, used, way, 1, 1);
    cout<<"NO";
}
