//Inshallah , Boys played well..!!

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pb push_back
#define pf push_front
#define mk make_pair
#define f(i,j,n) for(ll i=j;i<n;i++)
#define r(i,n,j) for(ll i=n-1;i>=j;i--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define Test int t;cin>>t;while(t--)
#define mod 1000000007
#define md 998244353
#define MIN INT_MIN
#define MAX INT_MAX
#define inf LLONG_MAX
#define all(container) container.begin() , container.end()
#define rall(container) container.rbegin() , container.rend()
#define sz(container) (int)container.size()
#define vll vector<long long>
#define vi vector<int>
#define pii pair <int , int>
#define pll pair <ll , ll>
#define fi first
#define se second
#define setp(x) setprecision(x)
#define meme(x,i) memset(x,i,sizeof(x))
const int N = 300005;
vi ans;
unordered_set<int> g[N],g1[N];
int vis[N],chk[N];
int n,m,x,y;
int par[N],p[N],in[N],child[N],rnk[N];
void init(){
    f(i,0,n+2){
        vis[i]=in[i]=chk[i]=child[i]=rnk[i]=0;
        g[i].clear();
        g1[i].clear();
        par[i]=i;
    }
}
int papa_kon(int v){
    if(v==par[v])
        return v;
    return par[v]=papa_kon(par[v]);
}
void topological_sort(){
    queue<int> q;
    f(i,1,n+1){
        if(in[i]==0 && !chk[i]){
            q.push(i);
            vis[i]=true;
        }
    }
    while(!q.empty()){
        int x=q.front();
        q.pop();
        if(!chk[x])
            ans.pb(x);
        for(auto &v:g1[x]){
            if(!vis[v]){
                in[v]--;
                if(in[v]==0){
                    q.push(v);
                    vis[v]=true;
                }
            }
        }
    }
}
void print(string s,int a[]){
    cout << s << endl;
    f(i,1,n+1)
    cout << a[i] << " ";
    cout << endl;
}
bool dfs(int z){
    vis[z] = 1;
    for(int x:g[z]){
        if(vis[x] == 2) continue;
        if(vis[x] == 1) return 1;
        if(dfs(x)) return 1;
    }
    vis[z] = 2;
    return 0;
}

bool cycle(){
    meme(vis,0);
    f(i,1,n+1){
        if(vis[i]) continue;
        if(dfs(i)) return 1;
    }
    return 0;
}
void solve() {
    cin >> n >> m;
    init();
    f(i,1,n+1){
        cin >> p[i];
        if(p[i])
            g[p[i]].insert(i);
    }
    f(i,0,m){
        cin >> x >> y;
        if(child[x] or chk[y] or (!g[y].empty()&&g[y].count(x))){
            cout << 0 << endl;
            return;
        }
        g[x].insert(y);
        par[y]=papa_kon(x);
        child[x]=y;
        chk[y]=true;
    }
    if(cycle()){
        cout << 0 << endl;return;
    }
    f(i,1,n+1){
        for(auto v:g[i]){
            if(papa_kon(i)!=papa_kon(v))
            g1[papa_kon(i)].insert(papa_kon(v));
        }
    }
    f(i,1,n+1){
        for(auto &v:g1[i]){
            in[v]++;
        }
    }
    meme(vis,0);
    topological_sort();
    f(i,1,n+1){
        if(!chk[i] && !vis[i]){
            cout << 0 << endl;
            return;
        }
    }
    f(i,0,sz(ans)){
        cout << ans[i] << " ";
        x=ans[i];
        while(child[x]){
            cout << child[x] << " ";
            x=child[x];
        }
    }
    cout << endl;
}

int main() {
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    //cin >> t;
    while (t--)  solve();
}
