func_code_string: #include <bits/stdc++.h>   using namespace std;   string itos(int x) {     stringstream ss;     ss << x;     return ss.str();   }   int n, m, d[300010], vis[300010];   pair<int, int> a[300010];   vector<int> e[300010], res;   int dfs(int now) {     if (vis[now]) return 0;     vis[now] = 1;     d[now] = (d[now] == 1);     for (auto x : e[now]) {       int y = (a[x].first == now ? a[x].second : a[x].first);       if (dfs(y)) {         res.push_back((x));         d[now] ^= 1;       }     }     return d[now] == 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> d[i];     for (int i = 0, u, v; i < m;) {       cin >> u >> v;       a[++i] = make_pair((--u), (--v));       e[u].push_back((i)), e[v].push_back((i));     }     int cnt1, free;     cnt1 = count_if(d, d + 300010, [](int x) { return x == 1; }),     free = count_if(d, d + 300010, [](int x) { return x == -1; });     if (cnt1 % 2 && not free) {       cout << -1 << endl;       return 0;     }     if (cnt1 % 2) *find(d, d + 300010, -1) = 1;     dfs(0);     cout << res.size() << endl;     for (int i = 0; i < res.size(); i++)       cout << res[i] << (i + 1 == res.size() ?   n  :    );     return 0;   }   