#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int n, m, w[MAXN], x[2 * MAXN], y[2 * MAXN], cnt[MAXN];
bool flg[2 * MAXN];
int ans[2 * MAXN], anssz = 0;
vector<int> idx[MAXN];
queue<int> q;
void f() {
  int k = q.front();
  q.pop();
  for (const int &a : idx[k]) {
    if (flg[a]) continue;
    ans[anssz++] = a;
    cnt[x[a]]--, cnt[y[a]]--;
    int j = (k == x[a] ? y[a] : x[a]);
    if (w[j] >= cnt[j]) q.push(j);
    flg[a] = true;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d %d", &x[i], &y[i]), cnt[x[i]]++, cnt[y[i]]++;
    idx[x[i]].push_back(i), idx[y[i]].push_back(i);
  }
  for (int i = 1; i <= n; ++i)
    if (w[i] - cnt[i] >= 0) q.emplace(i);
  while (!q.empty()) f();
  if (anssz != m) printf("DEAD\n"), exit(0);
  printf("ALIVE\n");
  for (int i = m - 1; i >= 0; --i) printf("%d ", ans[i]);
}
