#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > edges;
int v[100000];
int c[100000], qt[100000], uf[100000], vis[100000];
vector<int> ans;
vector<int> g[100000];
int f(int a) {
  if (a == uf[a]) return a;
  return uf[a] = f(uf[a]);
}
void u(int a, int b) {
  a = f(a);
  b = f(b);
  uf[a] = b;
}
int dfs(int curr, int prev) {
  vis[curr] = 1;
  qt[curr] = v[curr];
  for (int i = 0; i < g[curr].size(); i++) {
    int next = g[curr][i];
    if (next == prev) continue;
    qt[curr] += dfs(next, curr);
  }
  return qt[curr];
}
void swt(int curr) {
  qt[curr] += c[curr] == v[curr] ? 1 : -1;
  c[curr] = 1 - c[curr];
  ans.push_back(curr);
}
int dfs2(int curr, int prev) {
  int x = qt[curr];
  swt(curr);
  for (int i = 0; i < g[curr].size(); i++) {
    int next = g[curr][i];
    if (next == prev) continue;
    if (qt[next]) {
      qt[curr] -= dfs2(next, curr);
      swt(curr);
    }
    if (qt[next]) {
      qt[curr] -= dfs2(next, curr);
      swt(curr);
    }
  }
  return x - qt[curr];
}
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    edges.push_back(make_pair(a, b));
  }
  for (int i = 0; i < n; i++) {
    uf[i] = i;
    scanf("%d", &v[i]);
  }
  for (int i = 0; i < m; i++) {
    int a = edges[i].first, b = edges[i].second;
    if (v[a] == 1 && v[b] == 1) {
      if (f(a) != f(b)) {
        u(a, b);
        g[a].push_back(b);
        g[b].push_back(a);
      }
    }
  }
  for (int i = 0; i < m; i++) {
    int a = edges[i].first, b = edges[i].second;
    if (f(a) != f(b)) {
      u(a, b);
      g[a].push_back(b);
      g[b].push_back(a);
    }
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i]) dfs(i, -1);
  }
  for (int i = 0; i < n; i++) {
    if (qt[i]) {
      dfs2(i, -1);
      if (c[i] != v[i]) {
        ans.pop_back();
        c[i] = v[i];
      }
      break;
    }
  }
  bool ok = true;
  for (int i = 0; i < n; i++) {
    if (c[i] != v[i]) ok = false;
  }
  if (!ok) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i] + 1);
  if (ans.size()) printf("\n");
}
