#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <cstring>
#define endl '\n'

using namespace std;
typedef long long ll;

ll n, m;

vector<ll>d[100007];

ll used[100007], step[100007];
deque<ll>cur;

vector<ll>ans;

void dfs(ll v, ll par){
    if(ans.size() > 0)
        return;
    
    //cout << v << ' '  << par << endl;
    
    step[v] = step[par] + 1;
    used[v] = 1;
    cur.push_back(v);
    
    for(auto i: d[v]){
        if(i == par)
            continue;
        if(used[i] != 1)
            dfs(i, v);
        else{
            if(step[v] - step[i] + 1 == n){
                for(auto j: cur)
                    ans.push_back(j);
                ans.push_back(i);
                
                return;
            }
        }
    }
    
    //cout << "__" << endl;
    
    used[v] = 2;
    
    cur.pop_back();
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n >> m;
    
    for(int i = 0; i < m; i++){
        ll a, b;
        cin >> a >> b;
        
        d[a].push_back(b);
    }
    
    dfs(1, 0);
    
    if(ans.size() == 0)
        cout << "NO" << endl;
    else{
        cout << "YES" << endl;
        
        for(auto i: ans)
            cout << i << ' ';
        cout << endl;
    }
    
    return 0;
}
