#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> w(n);
  vector<int> sz(n);
  for (int i = 0; i < n; i++) cin >> w[i];
  vector<pair<int, int> > arr(m);
  vector<set<int> > pool(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    arr[i] = {a, b};
    pool[a].insert(i);
    pool[b].insert(i);
    sz[a]++;
    sz[b]++;
  }
  set<pair<int, int> > mn;
  for (int i = 0; i < n; i++) {
    mn.insert({sz[i] - w[i], i});
  }
  vector<int> ans;
  while (mn.size() > 0) {
    auto now = *mn.begin();
    if (now.first > 0) {
      cout << "DEAD\n";
      return 0;
    }
    mn.erase(now);
    for (int ind : pool[now.second]) {
      ans.push_back(ind + 1);
      int a = arr[ind].first, b = arr[ind].second;
      if (a == now.second) swap(a, b);
      mn.erase({sz[a] - w[a], a});
      sz[a]--;
      pool[a].erase(ind);
      mn.insert({sz[a] - w[a], a});
    }
  }
  cout << "ALIVE\n";
  reverse(ans.begin(), ans.end());
  for (auto elem : ans) cout << elem << " ";
  cout << endl;
}
