#include <bits/stdc++.h>

using namespace std;

struct City
{
	vector<int> in;
	vector<int> out;
};

int main()
{
	int n, m;
	cin>>n>>m;
	vector<City> roads(n);
	vector<int> nroads(n, 0);
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		roads[a].out.push_back(b);
		roads[b].in.push_back(a);
		nroads[a]++;
	}
	for(int i=0;i<n;i++) {
		int x = i;
		while (nroads[x] == 0) {
			bool b = true;
			for (auto j=roads[x].in.begin();j!=roads[x].in.end();j++) {
				if (nroads[(*j)] == 1){
					b = false;
					nroads[(*j)]--;
					x = (*j);
				}
			}
			if (b && x!=i) {
				x = roads[x].out[0];
			}
		}
	}
	vector<int> q(n+1, -1), tick(n, 0), nroads0(nroads);
	int y = 1;
	q[0] = 0;
	int x;
	bool b = false;
	while(y != 0) {
		x = q[y-1];
		if (q[n] == 0) {
			break;
		}
		int j = nroads[x]-1;
		while(j != -1 && tick[roads[x].out[j]] != 0 && (roads[x].out[j] == 0 || nroads[roads[x].out[j]]>0)) {
			j--;
		}
		if (j!= -1) {
			q[y] = roads[x].out[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";
	}
}