#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const long long INF = 2e18;
const int maxn = 1e6 + 6;
const int mod = 1e9 + 6;
const double eps = 1e-15;
inline bool read(long long &num) {
  char in;
  bool IsN = false;
  in = getchar();
  if (in == EOF) return false;
  while (in != '-' && (in < '0' || in > '9')) in = getchar();
  if (in == '-') {
    IsN = true;
    num = 0;
  } else
    num = in - '0';
  while (in = getchar(), in >= '0' && in <= '9') {
    num *= 10, num += in - '0';
  }
  if (IsN) num = -num;
  return true;
}
long long n, m, p;
long long num[maxn];
long long w[maxn];
vector<int> ans;
vector<pair<int, int>> v[maxn];
int vis[maxn];
int main() {
  memset(vis, 0, sizeof(vis));
  read(n);
  read(m);
  for (int i = 1; i <= n; i++) read(num[i]);
  for (int i = 1; i <= m; i++) {
    long long x, y;
    read(x);
    read(y);
    w[x]++;
    w[y]++;
    v[x].push_back({y, i});
    v[y].push_back({x, i});
  }
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (w[i] <= num[i]) q.push(i);
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto x : v[u]) {
      if (!vis[x.second]) {
        vis[x.second] = 1;
        ans.push_back(x.second);
        if (--w[x.first] <= num[x.first]) {
          q.push(x.first);
        }
      }
    }
  }
  if (ans.size() < m)
    printf("DEAD\n");
  else {
    printf("ALIVE\n");
    reverse(ans.begin(), ans.end());
    for (int x : ans) {
      printf("%d ", x);
    }
    printf("\n");
  }
  return 0;
}
