#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
void read(int& val) {
  int x = 0;
  int bz = 1;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    bz = -1;
    c = getchar();
  }
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
  val = x * bz;
}
const int mod = 1e9 + 7;
const int maxn = 2e6 + 7;
bool vis[maxn], out[maxn];
pair<int, int> food[maxn];
int s[maxn], w[maxn];
int n, m;
priority_queue<int> q;
int ans[maxn], tot;
vector<int> custom[maxn];
void del(int id) {
  for (auto to : custom[id]) {
    if (out[to]) continue;
    ans[++tot] = to;
    out[to] = true;
    int y = food[to].first;
    if (id == y) y = food[to].second;
    s[y]--;
    if (!vis[y] && s[y] <= w[y]) {
      vis[y] = true;
      q.push(y);
    }
  }
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= n; i++) read(w[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    read(x);
    read(y);
    food[i] = {x, y};
    custom[x].push_back(i);
    custom[y].push_back(i);
    s[x]++;
    s[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] <= w[i]) {
      q.push(i);
      vis[i] = true;
    }
  }
  while (!q.empty()) {
    int top = q.top();
    q.pop();
    del(top);
  }
  if (tot == m) {
    puts("ALIVE");
    for (int i = tot; i >= 1; i--) printf("%d ", ans[i]);
    puts("");
  } else {
    puts("DEAD");
  }
  return 0;
}
