#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 100;
int w[N], sum[N], n, m;
vector<pair<int, int>> node[N];
stack<int> ans;
bool vis[N];
bool topo() {
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (sum[i] <= w[i]) q.push(i);
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (auto it : node[u]) {
      int v = it.first, id = it.second;
      if (vis[id]) continue;
      vis[id] = true;
      ans.push(id);
      if (--sum[v] <= w[v]) q.push(v);
    }
  }
  return ans.size() == m;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", w + i);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    node[x].emplace_back(y, i);
    node[y].emplace_back(x, i);
    sum[x]++, sum[y]++;
  }
  if (topo()) {
    puts("ALIVE");
    while (ans.size()) {
      printf("%d ", ans.top());
      ans.pop();
    }
  } else
    puts("DEAD");
  return 0;
}
