#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
template <typename T>
void read(T &x) {
  int f = 1;
  x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  x *= f;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void println(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
  putchar('\n');
}
template <typename T, typename... Args>
void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
inline void reads(char *a) { scanf("%s", a); }
template <typename... Args>
void reads(char *a, Args *...args) {
  scanf("%s", a);
  reads(args...);
}
template <typename T, typename... Args>
void print(T x, Args... args) {
  print(x);
  putchar(' ');
  print(args...);
}
template <typename T, typename... Args>
void println(T x, Args... args) {
  print(x);
  putchar(' ');
  println(args...);
}
inline void prints(char *a) { printf("%s", a); }
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
inline T random(T R) {
  return (double)rand() / RAND_MAX * R + ((T)0.5 == 0 ? 0.5 : 0.0);
}
template <typename T>
inline T random(T L, T R) {
  return random(R - L) + L;
}
long long ksm(long long a, long long k, long long Mod) {
  long long res = 1;
  while (k) {
    if (k & 1) (res *= a) %= Mod;
    (a *= a) %= Mod;
    k >>= 1;
  }
  return res % Mod;
}
inline long long inv(long long a, long long Mod) {
  return ksm(a, Mod - 2, Mod);
}
inline void cap_bit(long long x) {
  for (int i = 63; i >= 0; --i)
    if (x >> i & 1) {
      printf("Need (%d) = %lld\n", i + 1, 1LL << (i + 1));
      return;
    }
}
inline void cal_space(long long x) { printf("%lld MB\n", x >> 20); }
const int dx4[] = {0, 0, -1, 1};
const int dy4[] = {-1, 1, 0, 0};
const int dx6[] = {1, -1, 0, 0, 0, 0};
const int dy6[] = {0, 0, 1, -1, 0, 0};
const int dz6[] = {0, 0, 0, 0, 1, -1};
const int N = 2e5 + 5;
const int M = 26;
const long long Mod = 1e9 + 7;
const long long INF = 1e16;
stack<int> stk;
set<int> sfood[N];
bool vis[N];
queue<int> q;
int n, m;
int w[N];
pair<int, int> a[N];
int main() {
  read(n, m);
  for (int i = 1; i <= n; ++i) read(w[i]);
  for (int i = 1; i <= m; ++i) {
    read(a[i].first, a[i].second);
    sfood[a[i].first].insert(i);
    sfood[a[i].second].insert(i);
  }
  for (int i = 1; i <= m; ++i) {
    int f1 = a[i].first, f2 = a[i].second;
    if (w[f1] >= sfood[f1].size() || w[f2] >= sfood[f2].size()) {
      q.push(i);
      vis[i] = 1;
    }
  }
  while (q.size()) {
    int u = q.front();
    q.pop();
    int f[2] = {a[u].first, a[u].second};
    stk.push(u);
    sfood[f[0]].erase(u);
    sfood[f[1]].erase(u);
    for (int i = 0; i <= 1; ++i) {
      if (sfood[f[i]].size() <= w[f[i]]) {
        for (auto j : sfood[f[i]]) {
          if (vis[j] == 0) {
            vis[j] = 1;
            q.push(j);
          }
        }
        sfood[f[i]].clear();
      }
    }
  }
  if (stk.size() < m)
    puts("DEAD");
  else {
    puts("ALIVE");
    while (stk.size()) {
      printf("%d ", stk.top());
      stk.pop();
    }
  }
  return 0;
}
