#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
const int M = N + 7;
const int MOD = 1e9 + 7;
const long long INF = 1e16 + 17;
vector<pair<int, int> > g[M];
int a[M], sz[M];
bool was[M];
int us[M];
int timer;
int ord[M];
void dfs(int v) {
  sz[v] = 0;
  us[v] = ++timer;
  ord[timer] = v;
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int to = g[v][i].first;
    if (!us[to]) {
      sz[to]--;
      if (sz[to] <= a[to]) {
        dfs(to);
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1, v, u; i <= m; ++i) {
    scanf("%d %d", &v, &u);
    g[v].push_back(make_pair(u, i));
    g[u].push_back(make_pair(v, i));
  }
  for (int i = 1; i <= n; ++i) {
    sz[i] = (int)g[i].size();
  }
  for (int i = 1; i <= n; ++i) {
    if (a[i] >= sz[i] && !us[i]) {
      dfs(i);
    }
  }
  if (timer != n) {
    printf("DEAD\n");
    return 0;
  }
  printf("ALIVE\n");
  for (int i = timer; i > 0; --i) {
    int v = ord[i];
    for (int j = 0; j < (int)g[v].size(); ++j) {
      int id = g[v][j].second;
      if (!was[id]) {
        printf("%d ", id);
        was[id] = true;
      }
    }
  }
  printf("\n");
  return 0;
}
