#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <ctime>
#include <iomanip>
#include <string>

using namespace std;

const int N = 1000020;
int us[N];
int n;
vector<int> res;
vector<int> g[N];

void dfs(int v, vector<int> p)
{
    p.push_back(v);
    us[v] = 1;
    for(auto to: g[v])
    {
        if(us[to] == 0)
        {
            dfs(to, p);
        }
        else
        if(to == 1 && p.size() == n)
        {
            res = p;
            return;
        }
    }
    us[v] = 0;
}

main()
{
    int m;
    cin>>n>>m;
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin>>a>>b;
        g[a].push_back(b);
    }
    dfs(1, res);
    if(res.size() != n)
    {
        cout<<"NO";
    }
    else
    {
        cout<<"YES";
        cout<<'\n';
        for(int t = 0; t >= n - 1; t++)
        {
            cout<<res[t]<<" ";
        }
        cout<<1;
    }
}