#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
bool ckmin(T &a, U b) {
  return b < a ? a = b, true : false;
}
template <typename T, typename U>
bool ckmax(T &a, U b) {
  return b > a ? a = b, true : false;
}
int n, m;
vector<bool> vis, done;
vector<int> v, cnt, ord;
vector<pair<int, int>> p;
set<pair<int, int>> st;
vector<vector<int>> adj;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  v.assign(n, 0);
  cnt.assign(n, 0);
  vis.assign(m, 0);
  done.assign(n, 0);
  p.assign(m, {-1, -1});
  adj.assign(n, vector<int>());
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  for (int i = 0; i < m; ++i) {
    cin >> p[i].first >> p[i].second;
    p[i].first--;
    p[i].second--;
    cnt[p[i].first]++;
    cnt[p[i].second]++;
    adj[p[i].first].push_back(i);
    adj[p[i].second].push_back(i);
  }
  for (int i = 0; i < n; ++i) {
    st.insert({cnt[i] - v[i], i});
  }
  while ((int)(st).size()) {
    auto it = st.begin();
    if (it->first > 0) {
      cout << "DEAD";
      return 0;
    }
    for (auto i : adj[it->second]) {
      if (!vis[i]) {
        vis[i] = true;
        ord.push_back(i);
        int oth = 0;
        if (it->second == p[i].first)
          oth = p[i].second;
        else
          oth = p[i].first;
        if (done[oth]) continue;
        st.erase({cnt[oth] - v[oth], oth});
        cnt[oth]--;
        st.insert({cnt[oth] - v[oth], oth});
      }
    }
    done[it->second] = true;
    st.erase(it);
  }
  reverse(ord.begin(), ord.end());
  cout << "ALIVE\n";
  for (auto i : ord) cout << i + 1 << " ";
  return 0;
}
