Problem: Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or  - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say, that it doesn't exist. Subset is called «good», if by by leaving only edges from this subset in the original graph, we obtain the following: for every vertex i, di = - 1 or it's degree modulo 2 is equal to di. Leha wants to pass the game as soon as possible and ask you to help him. In case of multiple correct answers, print any of them.

Input

The first line contains two integers n, m (1 ≤ n ≤ 3·105, n - 1 ≤ m ≤ 3·105) — number of vertices and edges.

The second line contains n integers d1, d2, ..., dn ( - 1 ≤ di ≤ 1) — numbers on the vertices.

Each of the next m lines contains two integers u and v (1 ≤ u, v ≤ n) — edges. It's guaranteed, that graph in the input is connected.

Output

Print  - 1 in a single line, if solution doesn't exist. Otherwise in the first line k — number of edges in a subset. In the next k lines indexes of edges. Edges are numerated in order as they are given in the input, starting from 1.

Examples

Input

1 0
1


Output

-1


Input

4 5
0 0 0 -1
1 2
2 3
3 4
1 4
2 4


Output

0


Input

2 1
1 1
1 2


Output

1
1


Input

3 3
0 -1 1
1 2
2 3
1 3


Output

1
2

Note

In the first sample we have single vertex without edges. It's degree is 0 and we can not get 1.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long int N = 3e5 + 5, inf = -1e12;
long long int sum[N];
long long int root(long long int ary[], long long int i) {
  while (ary[i] != i) {
    ary[i] = ary[ary[i]];
    i = ary[i];
  }
  return i;
}
long long int un(long long int ary[], long long int a, long long int b) {
  long long int rA = root(ary, a);
  long long int rB = root(ary, b);
  if (rA == rB) return 0;
  if (sum[rA] > sum[rB]) {
    ary[rB] = rA;
    sum[rA] += sum[rB];
  } else {
    ary[rA] = rB;
    sum[rB] += sum[rA];
  }
  return 1;
}
map<pair<long long int, long long int>, long long int> M;
vector<long long int> G[N];
long long int vis[N];
long long int ary[N], val[N], par[N];
long long int dfs(long long int a, long long int p) {
  long long int c = 0;
  for (long long int i = 0; i < G[a].size(); ++i) {
    long long int x = G[a][i];
    if (x != p) {
      par[x] = a;
      c += dfs(x, a);
    }
  }
  c %= 2;
  if ((val[a] == 0 & c == 0) || (val[a] == 1 && c == 1)) {
    c = 0;
    if (par[a] == 0) return 0;
    if (M.count(make_pair(a, par[a]))) {
      M[make_pair(a, par[a])] = -1;
    } else {
      M[make_pair(par[a], a)] = -1;
    }
  } else if (val[a] != -1) {
    if (par[a] == 0) {
      c = -1;
    } else {
      c = 1;
    }
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<pair<long long int, long long int> > ord;
  long long int s = 0;
  long long int cnt = 0;
  for (long long int i = 1; i < n + 1; ++i) {
    ary[i] = i;
    sum[i] = 1;
    cin >> val[i];
    if (val[i] != -1) {
      s += val[i];
    } else {
      cnt++;
    }
  }
  s %= 2;
  if (s == 0) {
    for (long long int i = 1; i < n + 1; ++i) {
      if (val[i] == -1) val[i] = 0;
    }
  } else {
    if (cnt == 0) {
      cout << -1 << "\n";
      return 0;
    } else {
      for (long long int i = 1; i < n + 1; ++i) {
        if (val[i] == -1) {
          if (cnt) {
            val[i] = 1;
            cnt = 0;
          } else {
            val[i] = 0;
          }
        }
      }
    }
  }
  vector<long long int> v;
  for (long long int i = 0; i < m; ++i) {
    long long int a, b;
    cin >> a >> b;
    if (un(ary, a, b) != 0) {
      G[a].push_back(b);
      G[b].push_back(a);
      M[make_pair(a, b)] = i + 1;
    }
  }
  vector<long long int> ans;
  long long int f = 0;
  long long int c = dfs(1, 0);
  if (c == -1) {
    f = 1;
  }
  if (f == 1) {
    cout << -1 << "\n";
  } else {
    vector<long long int> ans;
    for (auto it = M.begin(); it != M.end(); it++) {
      if ((*it).second != -1) ans.push_back((*it).second);
    }
    cout << ans.size() << "\n";
    sort(ans.begin(), ans.end());
    for (long long int i = 0; i < ans.size(); ++i) {
      cout << ans[i] << "\n";
    }
  }
  return 0;
}