#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int M = 2e5 + 5;
int w[M], du[M], book[M];
vector<pair<int, int> > g[M];
vector<int> ans;
queue<int> que;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int x, y, i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    g[x].push_back(make_pair(y, i));
    g[y].push_back(make_pair(x, i));
    du[x]++, du[y]++;
  }
  for (int i = 1; i <= n; i++)
    if (du[i] <= w[i]) que.push(i);
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    for (auto it : g[now]) {
      int v = it.first, id = it.second;
      if (book[id]) continue;
      book[id] = 1;
      ans.push_back(id);
      if (--du[v] == w[v]) que.push(v);
    }
  }
  if (ans.size() < m) return puts("DEAD"), 0;
  puts("ALIVE");
  reverse(ans.begin(), ans.end());
  for (auto it : ans) printf("%d ", it);
  return 0;
}
