#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n, m;
	cin>>n>>m;
	vector<vector<int>> roads(n);
	vector<int> nroads(n, 0);
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		roads[a].push_back(b);
		nroads[a]++;
	}
	vector<int> q(n+1, -1), tick(n, 0), nroads0(nroads);
	int y = 1;
	q[0] = 0;
	int x;
	bool b = false, b1;
	while(y != 0) {
		x = q[y-1];
		if (q[n] == 0) {
			break;
		}
		int j = nroads[x]-1;
		while(j != -1 && tick[roads[x][j]] != 0) {
			j--;
		}
		if (j!= -1) {
			q[y] = roads[x][j];
			nroads[x]--;
			tick[q[y]]=1;
			y++;
		} else {
			y--;
			tick[q[y]] = 0;
			nroads[q[y]] = nroads0[q[y]];
		}
	}
	if (y == 0) {
		cout<<"NO\n";
	} else {
		cout<<"YES\n";
		for (int i=0;i<y;i++) {
			cout<<q[i]+1<<' ';
		}
		cout<<"\n";
	}
}