#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const unsigned gen_seed =
    std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937_64 gen(gen_seed);
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  std::vector<int> w(n);
  for (int i = 0; i < n; i++) scanf("%d", &w[i]);
  std::vector<int> need(n, 0);
  std::vector<int> x(m), y(m);
  std::vector<std::vector<int> > h(n);
  std::vector<int> res;
  set<int> undone;
  std::vector<int> proc;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x[i], &y[i]);
    x[i]--;
    y[i]--;
    need[x[i]] += 1;
    need[y[i]] += 1;
    h[x[i]].push_back(i);
    h[y[i]].push_back(i);
    undone.insert(i);
  }
  for (int i = 0; i < m; i++) {
    if (need[x[i]] <= w[x[i]] || need[y[i]] <= w[y[i]]) {
      undone.erase(i);
      proc.push_back(i);
    }
  }
  while (proc.size() > 0) {
    int i = proc.back();
    res.push_back(i + 1);
    proc.pop_back();
    std::vector<int> toeat;
    toeat.push_back(x[i]);
    toeat.push_back(y[i]);
    for (auto d : toeat) {
      need[d] -= 1;
      if (need[d] == w[d]) {
        for (auto j : h[d]) {
          if (undone.find(j) != undone.end()) {
            undone.erase(j);
            proc.push_back(j);
          }
        }
      }
    }
  }
  if (undone.size() > 0) {
    cout << "DEAD\n";
    return 0;
  }
  reverse((res).begin(), (res).end());
  printf("ALIVE\n");
  for (auto x : res) printf("%d ", x);
}
