#include <bits/stdc++.h>
std::vector<bool> visited;
std::vector<int> trace;
std::vector<std::vector<int>> roads;
std::set<int> terminal;
int n;
bool walk(int x){
	trace.push_back(x);
	visited[x] = true;
	if(!x && trace.size() > 1){
		goto FAIL;
	}
	if(trace.size() == n)
		if(terminal.count(x)){
			trace.push_back(0);
			return true;
		}else goto FAIL;
	for(auto i : roads[x]){
		if(visited[i]) continue;
		if(walk(i)) return true;
	}
FAIL:
	trace.pop_back();
	return visited[x] = false;
}
int main(){
	int m, i, a, b;
	std::cin >> n >> m;
	visited.resize(n, false);
	roads.resize(n);
	for(i = 0; i < m; ++i){
		std::cin >> a >> b;
		roads[a-1].push_back(b-1);
		if(b == 1) terminal.insert(a - 1);
	}
	if(walk(0)){
		std::cout << "YES\n";
		for(auto i : trace)
			std::cout << i + 1 << ' ';
		std::cout << "\n";
	}else{
		std::cout << "NO\n";
	}
}
