#include <bits/stdc++.h>
using namespace std;

long long n, m, x, y;
vector<long long> v[int(1e5) + 5];
bool used[int(1e5)+5], answer = false;

void dfs1(long long pos) {
    used[pos] = true;
    for(int i = 0; i < v[pos].size(); i++) {
        if(!used[v[pos][i]]) dfs1(v[pos][i]);
    }
}

void dfs(long long pos, long long k) {
    if(pos == 1 && k == n+1) {answer = true; cout << "YES\n1 "; return;}
    used[pos] = true;
    for(int i = 0; i < v[pos].size(); i++) {
        if(!used[v[pos][i]] || v[pos][i] == 1 && k == n) dfs(v[pos][i], k+1);
        if(answer == true) {cout << pos << ' '; return;}
    }
    used[pos] = false;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i++) { 
        cin >> x >> y;
        v[x].push_back(y);
    }
    int temp = 0;
    for(int i = 1; i <= n; i++) {
        if(used[i] == false) {dfs1(i); temp++;};
    }
    if(temp > 1) {cout << "NO"; return 0;}
    for(int i = 1; i <= n; i++)
        used[i] = false;
    dfs(1, 1);
    if(!answer) cout << "NO";
}
