#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll DIM=100027;
const ll INF=2000000007;

long long n,m,v1,v2,t,k,h,num,ans,mini,maxi,lastnum,mina,maxa,x,p,cost;
long long used[DIM];
vector<ll> a[DIM];
vector<ll> res;

void dfs(int v)
{
    used[v]=1;

    for (auto to : a[v])
    {
        if (used[to]==0)
        {
            dfs(to);
        }
        if (used[to]==1 && to==1)
        {
            ans=1;
            break;
        }
    }
    res.push_back(v);
}

int main()
{
    cin >> n >> m;
    for (int i=1;i<=m;i++)
    {
        cin >> v1 >> v2;
        a[v1].push_back(v2);
    }

    ans=0;
    for (int i=1;i<=n;i++)
    {
        if (used[i]==0)
        {
            dfs(i);
        }
    }

    if (ans==1)
    {
        cout << "YES" << endl;
        reverse(res.begin(),res.end());
        for (auto x : res)
        {
            cout << x << ' ';
        }
        cout << 1 << endl;
    }
    else cout << "NO" << endl;

    return 0;
}
