#include <bits/stdc++.h>
using namespace std;
int N, M;
int bal[100000];
bool vis[100000][2];
vector<int> ans;
vector<pair<int, int> > graph[100000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(vis, 0, sizeof(bool) * N * 2);
  cin >> N >> M;
  for (int i = (0); i < (N); i++) cin >> bal[i];
  for (int i = (0); i < (M); i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    graph[a].emplace_back(make_pair(b, i + 1));
    graph[b].emplace_back(make_pair(a, i + 1));
    bal[a]--;
    bal[b]--;
  }
  vector<int> stack;
  for (int i = (0); i < (N); i++) {
    if (bal[i] >= 0) {
      stack.emplace_back(i);
      vis[i][0] = true;
    }
  }
  while (!stack.empty()) {
    int cur = stack.back();
    stack.pop_back();
    vis[cur][1] = true;
    for (pair<int, int> con : graph[cur]) {
      if (vis[con.first][1]) continue;
      ans.emplace_back(con.second);
      bal[con.first]++;
      if (bal[con.first] >= 0 && !vis[con.first][0]) {
        stack.emplace_back(con.first);
        vis[con.first][0] = true;
      }
    }
  }
  if (ans.size() == M) {
    cout << "ALIVE\n";
    for (int i = (ans.size() - 1); i >= (0); i--) {
      cout << ans[i];
      if (i != 0) cout << ' ';
    }
    cout << '\n';
  } else
    cout << "DEAD\n";
}
