#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> count(n);
  for (long long i = 0; i < n; i++) {
    cin >> count[i];
  }
  vector<long long> freq(n, 0);
  vector<vector<pair<long long, long long>>> adj(n);
  for (long long i = 0; i < m; i++) {
    long long x, y;
    cin >> x >> y;
    x--;
    y--;
    freq[x]++;
    freq[y]++;
    adj[x].push_back({y, i});
    adj[y].push_back({x, i});
  }
  queue<long long> q;
  vector<bool> visited(n, false);
  for (long long i = 0; i < n; i++) {
    if (freq[i] <= count[i]) {
      q.push(i);
      visited[i] = 1;
    }
  }
  vector<bool> rem(m, true);
  vector<long long> result;
  while (!q.empty()) {
    long long current = q.front();
    q.pop();
    for (auto u : adj[current]) {
      if (rem[u.second]) {
        rem[u.second] = false;
        freq[u.first]--;
        result.push_back(u.second);
      }
      if (freq[u.first] <= count[u.first] && !visited[u.first]) {
        q.push(u.first);
        visited[u.first] = 1;
      }
    }
  }
  if (result.size() < m) {
    cout << "DEAD" << endl;
    return;
  }
  cout << "ALIVE" << endl;
  for (long long i = result.size() - 1; i >= 0; i--) {
    cout << ++result[i] << " ";
  }
  return;
}
int32_t main() {
  solve();
  return 0;
}
