#include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 7;   const int INF = 1e9 + 7;   const int MOD = 1e9 + 7;   struct as {     int id, x;   } a[maxn];   int vis[maxn];   bool cmp(as a, as b) { return a.x < b.x; }   vector<int> g[maxn];   vector<int> ans;   set<int> tmp;   bool check(as a) {     int i, j;     for (i = 0; i < g[a.id].size(); i++) {       if (vis[g[a.id][i]] == a.x) return false;       if (vis[g[a.id][i]]) tmp.insert(vis[g[a.id][i]]);     }     if (tmp.size() != a.x - 1) return false;     tmp.clear();     vis[a.id] = a.x;     return true;   }   int main() {     int i, j, n, m, t, z;     scanf( %d%d , &n, &m);     for (i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       g[x].push_back(y);       g[y].push_back(x);     }     for (i = 1; i <= n; i++) {       scanf( %d , &a[i].x);       a[i].id = i;     }     sort(a + 1, a + 1 + n, cmp);     for (i = 1; i <= n; i++) {       if (!check(a[i])) break;       ans.push_back(a[i].id);     }     if (i <= n) {       printf( -1 n );     } else {       for (i = 0; i < n; i++) {         printf( %d%c , ans[i], i == n - 1 ?   n  :    );       }     }     return 0;   }   