#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 922337203685477;
const long long mininf = -922337203685477;
const long long nax = 1e5 + 5;
long long n, m;
long long w[nax];
vector<vector<pair<long long, long long>>> v(nax);
long long eat[2 * nax], vis[nax], cnt[nax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (long long i = 1; i <= m; i++) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back({y, i});
    v[y].push_back({x, i});
    cnt[x]++, cnt[y]++;
  }
  queue<long long> q;
  for (long long i = 1; i <= n; i++) {
    if (cnt[i] <= w[i]) {
      vis[i] = 1;
      q.push(i);
    }
  }
  vector<long long> ans;
  while (!q.empty()) {
    long long cur = q.front();
    q.pop();
    for (auto x : v[cur]) {
      if (eat[x.second]) {
        continue;
      }
      ans.push_back(x.second);
      eat[x.second] = 1;
      cnt[cur]--, cnt[x.first]--;
      if (cnt[x.first] <= w[x.first] && !vis[x.first]) {
        vis[x.first] = 1;
        q.push(x.first);
      }
    }
  }
  if (ans.size() != m) {
    cout << "DEAD" << '\n';
  } else {
    reverse(ans.begin(), ans.end());
    cout << "ALIVE" << '\n';
    for (auto x : ans) {
      cout << x << " ";
    }
    cout << '\n';
  }
}
