#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  for (auto &i : v) cin >> i;
  vector<vector<pair<long long, long long>>> g(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    g[x].push_back({y, i});
    g[y].push_back({x, i});
  }
  queue<int> q;
  vector<bool> s(n);
  for (int i = 0; i < n; i++)
    if (g[i].size() <= v[i]) {
      q.push(i);
      s[i] = true;
    }
  vector<int> d(n);
  for (int i = 0; i < n; i++) d[i] = g[i].size();
  vector<int> ans;
  while (!q.empty()) {
    int c = q.front();
    q.pop();
    for (auto w : g[c])
      if (d[w.first] > 0) {
        --d[w.first];
        --d[c];
        ans.push_back(w.second + 1);
        if (d[w.first] <= v[w.first] && !s[w.first]) {
          q.push(w.first);
          s[w.first] = true;
        }
      }
  }
  if (ans.size() == m) {
    cout << "ALIVE\n";
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < m; i++) cout << ans[i] << " \n"[i == m - 1];
  } else
    cout << "DEAD\n";
  return 0;
}
