#include <bits/stdc++.h>
const int N = 200020;
int _, n, m, x, y, flag, a[N], c[N], d[N];
std::queue<int> q;
std::pair<int, int> b[N];
std::vector<int> g[N], ans;
void f(int u) {
  if (++a[u] > g[u].size() && !c[u]) q.push(u), c[u] = 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    b[i] = {x, y};
    g[x].push_back(i);
    g[y].push_back(i);
  }
  for (int i = 1; i <= n; i++) f(i);
  for (; q.size(); q.pop())
    for (int u : g[q.front()])
      if (!d[u]) ans.push_back(u), f(b[u].first), f(b[u].second), d[u] = 1;
  if (ans.size() == m) {
    puts("ALIVE");
    reverse(ans.begin(), ans.end());
    for (int j : ans) printf("%d ", j);
  } else
    puts("DEAD");
}
