#include <bits/stdc++.h>

using namespace std;

vector<int> g[100000];
set<int> relaxed[100000];
bool used[100000];
bool res=false;
int p[100000], fin, vis, n, m;

void dfs(int v)
{
    used[v]=true;
    vis++;
    for(auto i : g[v])
    {
        if(!i)
        {
            if(vis==n)
            {
                fin=v;
                res=true;
            }
        }
        else if(!used[i])
        {
            p[i]=v;
            dfs(i);
        }
        if(res) return;
    }
    used[v]=false;
    vis--;
}

int main()
{
    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        int a, b;
        cin>>a>>b;
        g[a-1].push_back(b-1);
    }
    dfs(0);
    if(res)
    {
        cout<<"YES\n";
        vector<int> wae;
        p[0]=-1;
        wae.push_back(0);
        int v=fin;
        while(v+1)
        {
            wae.push_back(v);
            v=p[v];
        }
        reverse(wae.begin(), wae.end());
        for(auto i : wae)   cout<<i+1<<' ';
    }
    else cout<<"NO\n";
    return 0;
}
