#include <iostream>
#include <vector>
#include <bits/stdc++.h>

// #define int long long
#define endl '\n'
//#define inf 2000000000000000000
#define random (rand()^(rand()<<15))

using namespace std;
//constexpr int mod=1000000007;
//constexpr int MOD=998244353;
bool used[100010];
vector<vector<int>>g;
vector<int>res;
int n;
bool dfs(int v,int gl=0)
{
    used[v]=1;
    for(int&i:g[v])
    {
        if(used[i])
        {
            if(i==0&&gl+1==n)
            {
                res.push_back(v+1);
                return 1;
            }
            continue;
        }
        if(dfs(i,gl+1))
        {
            res.push_back(v+1);
            return 1;
        }
    }
    used[v]=0;
    return 0;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int m;
    cin>>n>>m;
    g.resize(n);
    res.reserve(n);
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        x--;y--;
        g[x].push_back(y);
    }
    if(!dfs(0,0))
    {
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
    reverse(res.begin(),res.end());
    for(int&i:res)
    {
        cout<<i<<" ";
    }
    cout<<res[0]<<endl;
}
