#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long p = 1, data = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    data = data * 10 + (ch ^ 48);
    ch = getchar();
  }
  return p * data;
}
inline long long qpow(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = a * r;
    a = a * a;
    b >>= 1;
  }
  return r;
}
inline long long gcd(long long a, long long b) {
  if (!a || !b) return (!a) ? b : a;
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
inline long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
void exgcd(long long a, long long b, long long &x, long long &y) {
  if (!b)
    x = 1, y = 0;
  else {
    exgcd(b, a % b, y, x);
    y -= x * (a / b);
  }
}
const int mod = 1e9 + 7, maxn = 2e5 + 5;
int w[maxn], b[maxn], ans[maxn], vis[maxn], had[maxn], tot;
pair<int, int> a[maxn];
vector<pair<int, int> > G[maxn];
int main() {
  int n = read(), m = read();
  for (int i = 1; i <= n; i++) w[i] = read();
  for (int i = 1; i <= m; i++) {
    a[i].first = read(), a[i].second = read();
    b[a[i].first]++, b[a[i].second]++;
    G[a[i].first].push_back({a[i].second, i});
    G[a[i].second].push_back({a[i].first, i});
  }
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (b[i] <= w[i]) q.push(i);
  while (!q.empty()) {
    auto t = q.front();
    q.pop();
    vis[t] = 1;
    for (auto v : G[t]) {
      if (had[v.second]) continue;
      had[v.second] = 1;
      b[v.first]--;
      ans[++tot] = v.second;
      if (b[v.first] <= w[v.first] && !vis[v.first]) q.push(v.first);
    }
  }
  if (tot != m)
    puts("DEAD");
  else {
    puts("ALIVE");
    for (int i = m; i >= 1; i--) printf("%d ", ans[i]);
  }
  return 0;
}
