#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int pl[n];
  for (int i = 0; i < n; ++i) cin >> pl[i];
  vector<int> fep[n], ca(n, 0), an;
  pair<int, int> sf[m];
  for (int i = 0, a, b; i < m; ++i) {
    cin >> a >> b;
    a--;
    b--;
    fep[a].push_back(i);
    ca[a]++;
    fep[b].push_back(i);
    ca[b]++;
    sf[i] = {a, b};
  }
  set<pair<int, int> > psc;
  vector<bool> dn(n, 0);
  for (int i = 0; i < n; ++i) {
    psc.insert({ca[i] - pl[i], i});
  }
  while (!psc.empty()) {
    pair<int, int> nw = *psc.begin();
    psc.erase(psc.begin());
    if (dn[nw.second]) continue;
    if (nw.first > 0) {
      cout << "DEAD\n";
      return 0;
    }
    dn[nw.second] = 1;
    for (int e : fep[nw.second]) {
      int l = (sf[e].first != nw.second) ? sf[e].first : sf[e].second;
      if (dn[l]) continue;
      ca[l]--;
      psc.insert({ca[l] - pl[l], l});
      an.push_back(e + 1);
    }
  }
  cout << "ALIVE\n";
  for (int i = an.size() - 1; i >= 0; --i) cout << an[i] << ' ';
  return 0;
}
