#include <bits/stdc++.h>
std::vector<bool> visited;
std::vector<int> trace;
std::vector<std::vector<int>> roads;
int n;
bool walk(int x){
	trace.push_back(x);
	visited[x] = true;
	if(!x && trace.size() > 1){
		if(trace.size() == n + 1) return true;
		else goto FAIL;
	}
	if(x && trace.size() == n + 1) goto FAIL;
	for(auto i : roads[x]){
		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(walk(0)){
		std::cout << "YES\n";
		for(auto i : trace)
			std::cout << i + 1 << ' ';
		std::cout << "\n";
	}else{
		std::cout << "NO\n";
	}
}
