#include <iostream>
using namespace std;

int a[200005];
int b[200005];
int resultPath[200005];
bool visited[200005];

bool search(int currentNode, int visitedAmount, int roadAmount, int cityAmount) {
	// cout << "Current node: " << currentNode << ", visitedAmount: " << visitedAmount<<'\n';
	visitedAmount++;
	if(currentNode!=1)visited[currentNode] = true;
	for (int i = 1; i <= roadAmount; i++) {
		if (a[i] == currentNode && visited[b[i]]==false) {
			if (visitedAmount == cityAmount+1 && b[i] == 1) {
				resultPath[visitedAmount] = currentNode;
				return true;
			}
			else {
				resultPath[visitedAmount] = currentNode;
				bool foundAtNext = search(b[i],
					visitedAmount, roadAmount, cityAmount);
				if (foundAtNext) {
					return true;
				}
			}
		}
	}
	visited[currentNode] = false;
	return false;
}

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 1; i <= n; i++) {
		visited[i] = false;
	}
	bool res = search(1, 1, m, n);
	if (res) {
		cout << "YES\n";
		for (int i = 2; i <= n+1; i++) {
			cout << resultPath[i]<<' ';
		}
		cout << 1;
	}
	else {
		cout << "NO";
	}
	return 0;
}
