#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& cout, vector<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
template <class L, class R>
ostream& operator<<(ostream& cout, pair<L, R> P) {
  return cout << '(' << P.first << ',' << P.second << ')';
}
const int N = 2e5 + 3;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> have(n + 1, 0), required(n + 1, 0), exhausted(n + 1, 0),
      taken(m + 1, 0);
  vector<pair<int, int>> gr[n + 1];
  queue<int> options;
  for (int i = 1; i <= n; ++i) cin >> have[i];
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    required[u]++;
    required[v]++;
    gr[u].push_back({v, i});
    gr[v].push_back({u, i});
  }
  for (int i = 1; i <= n; ++i) {
    if (have[i] >= required[i]) {
      options.push(i), exhausted[i] = 1;
    }
  }
  vector<int> ans;
  while (options.size()) {
    int taking = options.front();
    options.pop();
    for (pair<int, int> edge : gr[taking]) {
      if (!taken[edge.second])
        ans.push_back(edge.second), taken[edge.second] = 1;
      assert(edge.first <= n);
      if (!exhausted[edge.first]) {
        --required[edge.first];
        if (have[edge.first] >= required[edge.first] && required[edge.first]) {
          exhausted[edge.first] = 1;
          options.push(edge.first);
        }
      }
    }
  }
  if (ans.size() == m) {
    cout << "ALIVE\n";
    reverse(ans.begin(), ans.end());
    for (auto it : ans) cout << it << " ";
  } else
    cout << "DEAD\n";
}
