#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int base = 1e9 + 7;
int w[maxn], need[maxn], x[maxn], y[maxn], ans[maxn];
bool in_ans[maxn];
vector<int> vec[maxn];
queue<int> que;
int main() {
  memset(in_ans, false, sizeof(in_ans));
  int n, m, cnt = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x[i], &y[i]);
    w[x[i]]--;
    w[y[i]]--;
    vec[x[i]].push_back(i);
    vec[y[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (w[i] >= 0) que.push(i);
  }
  int k, size, u, another;
  while (!que.empty()) {
    k = que.front();
    que.pop();
    size = vec[k].size();
    for (int i = 0; i < size; i++) {
      u = vec[k][i];
      if (!in_ans[u]) ans[++cnt] = u, in_ans[u] = true;
      if (x[u] != k)
        another = x[u];
      else
        another = y[u];
      w[another]++;
      if (w[another] == 0) que.push(another);
    }
  }
  if (cnt < m)
    printf("DEAD\n");
  else {
    printf("ALIVE\n");
    for (int i = cnt; i >= 1; i--) printf("%d ", ans[i]);
  }
}
