#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int MR = 2e5 + 10;
int w[MR];
pair<int, int> t[MR];
set<int> g[MR];
int main() {
  fast_io();
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); ++i) scanf("%d", &w[i]);
  for (int i = 0; i < (m); ++i) {
    scanf("%d%d", &t[i].first, &t[i].second);
    t[i].first--;
    t[i].second--;
    g[t[i].first].insert(i);
    g[t[i].second].insert(i);
  }
  set<pair<int, int> > S;
  for (int i = 0; i < (n); ++i) S.insert(make_pair(w[i] - g[i].size(), i));
  vector<int> res;
  for (int i = 0; i < (n); ++i) {
    auto it = S.end();
    it--;
    if (it->first < 0) {
      printf("DEAD\n");
      return 0;
    }
    for (int v : g[it->second]) {
      res.push_back(v);
      int nr;
      if (t[v].first != it->second)
        nr = t[v].first;
      else
        nr = t[v].second;
      S.erase(make_pair(w[nr] - g[nr].size(), nr));
      g[nr].erase(v);
      S.insert(make_pair(w[nr] - g[nr].size(), nr));
    }
    g[it->second].clear();
    S.erase(it);
  }
  reverse(res.begin(), res.end());
  printf("ALIVE\n");
  for (int r : res) printf("%d ", r + 1);
  printf("\n");
  return 0;
}
