#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>
#define int long long

using namespace std;

const int N = 100020;
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;
}

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