#include<bits/stdc++.h>
#include<math.h>
using namespace std;

typedef long long ll;


int x[301000], a[301000], y[301000], pre[301000];
int last[301000];
int vis[301000];
int ans[301000];
int tmp(int x) {
    if(x == pre[x]) return x;
    return pre[x] = tmp(pre[x]);
}
vector<int>g[301000];
vector<int>u[301000];
int d[301000];
int ok = 0;
int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        pre[i] = i;
    }


    for(int i = 1; i <= m; i++) {
        scanf("%d%d", &x[i], &y[i]);

        if(last[y[i]] == x[i]) ok = 1;
//        cout<<last[y[i]]<<" "<<x[i]<<endl;
        last[x[i]] = y[i];
        pre[tmp(y[i])] = tmp(x[i]);
    }

    if(ok) {
//            cout<<"??"<<endl;
        cout << 0 << endl;
        return 0;
    }
    int num = 0;
    for(int i = 1; i <= n; i++) {
        if(a[i] && tmp(a[i]) != tmp(i)) {
            g[tmp(a[i])].push_back(tmp(i));
            vis[tmp(i)]++;
        }
        if(tmp(i) == i) num++;
    }
    queue<int>q;
    for(int i = 1; i <= n; i++) {
        if(tmp(i) == i && vis[i] == 0) q.push(i);
    }
    int op = 0;
    while(!q.empty()) {
        int x = q.front();
        q.pop();
        ans[++op] = x;
//        cout<<x<<endl;
        for(auto j : g[x]) {
            vis[j]--;
            if(vis[j] == 0) {
                q.push(j);
            }
        }
    }
//    cout<<vis[1]<<endl;
    if(op != num) {
        cout << 0 << endl;
        return 0;
    }
    vis[0] = 1;
    vector<int>res;
    for(int i = 1; i <= op; i++) {
        int x = ans[i];
        if(!vis[a[x]]) {
            cout << 0 << endl;
            return 0;
        }
        res.push_back(x);
        vis[x] = 1;
        while(last[x]) {
            x = last[x];
            if(!vis[a[x]]) {
                cout << 0 << endl;
                return 0;
            }
            res.push_back(x);
            vis[x] = 1;

        }
    }
    for(auto i : res) cout << i << " ";
}
