#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
int n, m, k = 1, w[maxn], ned[maxn], head[maxn], vis[maxn];
struct Edge {
  int to, next, node;
} edge[maxn * 2];
void add(int u, int v, int i) {
  edge[++k].to = v;
  edge[k].next = head[u];
  head[u] = k;
  edge[k].node = i;
}
vector<int> a;
void Topsort() {
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (ned[i] <= w[i]) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i; i = edge[i].next) {
      if (vis[edge[i].node]) continue;
      vis[edge[i].node] = 1;
      a.push_back(edge[i].node);
      ned[edge[i].to]--;
      if (ned[edge[i].to] <= w[edge[i].to]) {
        q.push(edge[i].to);
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    ned[x]++;
    ned[y]++;
    add(x, y, i);
    add(y, x, i);
  }
  Topsort();
  if (a.size() == m) {
    cout << "ALIVE" << endl;
    for (int i = a.size() - 1; i >= 0; i--) cout << a[i] << ' ';
    cout << endl;
  } else {
    cout << "DEAD" << endl;
  }
  return 0;
}
