#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.14159265358979323846;
const long long INF = 9223372036854775807 / 2;
const long long mod = 1e9 + 7;
long long fastPow(long long b, long long e) {
  long long r = 1;
  while (e) {
    if (e % 2 == 1) {
      r *= b;
      r %= mod;
    }
    b *= b;
    b %= mod;
    e /= 2;
  }
  return r;
}
long long pgcd(long long a, long long b) {
  if (a % b == 0)
    return b;
  else
    return pgcd(b, a % b);
}
long long sign(long long a) {
  if (a < 0) {
    return -1;
  }
  if (a == 0) {
    return 0;
  }
  return 1;
}
bool isPrime(long long a) {
  if (a <= 1) {
    return false;
  }
  long long f = a;
  for (long long i = 2; i * i <= f; i++) {
    if (a % i == 0) {
      return false;
    }
  }
  return true;
}
long long toInt(string s) {
  long long tot = 0;
  for (long long i = s.size() - 1; i >= 0; i--) {
    tot += ((s[i] - '0') % mod) * fastPow(10, i);
    tot %= mod;
  }
  return tot;
}
string toString(long long a) {
  string s = "";
  while (a) {
    s = (char)('0' + a % 10) + s;
    a /= 10;
  }
  return s;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<long long> w(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> w[i];
  }
  vector<long long> degree(n + 1);
  vector<long long> visited(n + 1);
  vector<vector<pair<long long, long long> > > Graph(n + 1);
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    Graph[a].push_back({b, i});
    Graph[b].push_back({a, i});
    degree[a]++;
    degree[b]++;
  }
  deque<long long> q;
  for (long long i = 1; i <= n; i++) {
    if (degree[i] <= w[i]) {
      q.push_back(i);
    }
  }
  vector<long long> ans;
  while (!q.empty()) {
    long long node = q.front();
    q.pop_front();
    if (visited[node]) continue;
    visited[node] = true;
    for (pair<long long, long long> a : Graph[node]) {
      if (visited[a.first]) continue;
      degree[a.first]--;
      ans.push_back(a.second);
      if (degree[a.first] <= w[a.first]) {
        q.push_back(a.first);
      }
    }
  }
  if ((long long)ans.size() == m) {
    reverse(ans.begin(), ans.end());
    cout << "ALIVE" << endl;
    for (long long a : ans) {
      cout << a + 1 << ' ';
    }
    cout << '\n';
  } else {
    cout << "DEAD" << endl;
  }
}
