#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int w[n], x[m], y[m];
  for (int i = 0; i < n; i++) cin >> w[i];
  vector<vector<long long> > s(n, vector<long long>());
  vector<long long> sz(n, 0);
  for (int i = 0; i < m; i++) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    s[x[i]].push_back(i);
    s[y[i]].push_back(i);
    sz[x[i]]++;
    sz[y[i]]++;
  }
  priority_queue<pair<int, int> > pq;
  vector<bool> visited(m, false);
  for (int i = 0; i < n; i++) {
    pq.push(make_pair(w[i] - sz[i], i));
  }
  vector<int> rez;
  while (!pq.empty() && rez.size() < m) {
    pair<int, int> k = pq.top();
    pq.pop();
    int curr = k.second;
    if (k.first != w[curr] - sz[curr]) continue;
    if (k.first < 0) {
      cout << "DEAD";
      return 0;
    }
    int count = 0;
    for (int i = 0; i < s[curr].size(); i++) {
      if (count > sz[curr]) break;
      int trenutni = s[curr][i];
      if (!visited[trenutni]) {
        count++;
        rez.push_back(trenutni);
        visited[trenutni] = true;
        sz[x[trenutni]]--;
        sz[y[trenutni]]--;
        pq.push(make_pair(w[x[trenutni]] - sz[x[trenutni]], x[trenutni]));
        pq.push(make_pair(w[y[trenutni]] - sz[y[trenutni]], y[trenutni]));
      }
    }
  }
  if (rez.size() == m) {
    cout << "ALIVE" << endl;
    for (int i = m - 1; i >= 0; i--) {
      cout << rez[i] + 1 << " ";
    }
  } else
    cout << "DEAD" << endl;
  return 0;
}
