#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define F first
#define S second
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pii pair<ll, ll>

using namespace std;

int n, m;
vector<int> w[100025];
int used[100005];
vector<int> v={1};

void rec(int);

int main(){
	fast;
	int a, b;
	cin >> n >> m;
	if(m < n-1)
		cout << "NO\n";
	for(int i = 0; i < m; i++){
		cin >> a >> b;
		w[a].pb(b);
	}
	for(auto i:w[1])
		if(!used[i])
			rec(i);
	cout << "NO2\n";
}

void rec(int a){
	if(a == 1){
		if((int)v.size()!=n)
			return;
		cout << "YES\n";
		for(auto i:v)
			cout << i << ' ';
		cout << "1\n";
		exit(0);
	}else if((int)v.size() >= n) return;
	used[a] = 1;
	v.pb(a);/*
	for(auto i:v)
		cout << i << ' ';
	cout << '\n';*/
	for(auto i:w[a])
		if(!used[i])
			rec(i);
	v.pop_back();
	used[a] = 0;
}
