#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int read(T &a) {
  a = 0;
  char c = getchar(), f = 1;
  while (c > '9' || c < '0') {
    if (c == '-') f = (~f) + 1;
    if (c == -1) return -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0')
    a = (a << 1) + (a << 3) + (c ^ 48), c = getchar();
  a *= f;
  return 1;
}
template <typename T>
inline int write(T a) {
  if (a < 0) putchar('-'), a = (~a) + 1;
  if (a / 10) return write(a / 10) & putchar(a % 10 | 48);
  return putchar(a | 48);
}
template <typename T>
inline int write(T a, char c) {
  return write(a) + putchar(c);
}
int n, m;
int w[200001];
int x[200001], y[200001];
int need[200001];
bool used[200001];
vector<int> v[200001];
bool ok[200001];
queue<int> q;
int ans[200001], cnt;
int main() {
  read(n), read(m);
  for (int i = 1; i <= n; i++) read(w[i]);
  for (int i = 1; i <= m; i++) {
    read(x[i]), read(y[i]), need[x[i]]++, need[y[i]]++;
    v[x[i]].push_back(i);
    v[y[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++)
    if (need[i] <= w[i]) {
      used[i] = 1;
      for (auto j : v[i])
        if (!ok[j]) {
          ok[j] = 1;
          q.push(j);
        }
    }
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    ans[++cnt] = t;
    need[x[t]]--, need[y[t]]--;
    int i = y[t];
    if (need[i] <= w[i] && !used[i]) {
      used[i] = 1;
      for (auto j : v[i])
        if (!ok[j]) {
          ok[j] = 1;
          q.push(j);
        }
    }
    i = x[t];
    if (need[i] <= w[i] && !used[i]) {
      used[i] = 1;
      for (auto j : v[i])
        if (!ok[j]) {
          ok[j] = 1;
          q.push(j);
        }
    }
  }
  if (cnt != m) return puts("DEAD") & 0;
  puts("ALIVE");
  for (int i = cnt; i >= 1; i--) write(ans[i], ' ');
  puts("");
}
