#include<bits/stdc++.h>
#define int long long
#define endl "\n";

using namespace std;
bool way = false;
vector<vector<int>> g;
vector<int> rw;

void bfs(int top, int lenth, vector<bool> v, vector<int> w) {
	v[top] = true;
	w.push_back(top);
	for(int i = 0; i < g[top].size(); i++) {
		if(!v[g[top][i]]) {
			bfs(g[top][i], lenth+1, v, w);
		} else {
			if(g[top][i] == 1 && lenth == g.size() - 1 && !way) {
				way = true;
				for(int i = 0; i < w.size(); i++) {
					rw.push_back(w[i]);
				}
			}
		}
	}
}

signed main() {
	
	    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	
	int n, m;
	cin >> n >> m;
	g.resize(n+1);
	vector<bool> v(n+1, false);
		
	for(int i = 0; i < m; i++) {
		int l, p;
		cin >> l >> p;
		g[l].push_back(p);
	}
	vector<int> w;
	bfs(1, 1, v, w);
	
	if(way) {
		cout << "YES" << endl;;
		for(int i = 0; i < n; i++) {
			cout << rw[i] << " ";
		}
		cout << 1;
		
	} else {
		cout << "NO";
	}
	
	return 0;
}