#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <numeric>
#include <map>
#include <cassert>
#include <algorithm>

using namespace std;

#define int long long

vector<vector<int>> adj;
vector<bool> used;
vector<int> p;
int d = 0;
int ansv = -1;

int dfs(int v, int pr)
{
	used[v] = 1;
	p[v] = pr;
	++d;
	for (int i = 0; i < adj[v].size(); ++i)
	{
		if (adj[v][i] == 0 && d == adj.size() && ansv == -1)
		{
			ansv = v;
			return 1;
		}
		if (used[adj[v][i]]) continue;
		if (dfs(adj[v][i], v)) return 1;
	}
	--d;
	used[v] = 0;
	return 0;
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m, c1, c2;
	cin >> n >> m;
	adj.resize(n);
	used.resize(n);
	p.resize(n);
	p[0] = 0;
	for (int i = 0; i < m; ++i)
	{
		cin >> c1 >> c2;
		--c1;
		--c2;
		adj[c1].push_back(c2);
	}
	cout << (dfs(0, -1) ? "YES" : "NO") << '\n';
	if (d == n)
	{
		vector<int> ans;
		ans.push_back(1);
		ans.push_back(ansv + 1);
		while (p[ansv] != -1)
		{
			ans.push_back(1 + p[ansv]);
			ansv = p[ansv];
		}
		reverse(ans.begin(), ans.end());
		for (int i = 0; i <= n; ++i) cout << ans[i] << " ";
		cout << '\n';
	}
	return 0;
}
