#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<bool> used, used2, x, c_x;
vector<int> path;
bool dfs1(int v) {
  bool ans = x[v];
  used[v] = true;
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int to = g[v][i];
    if (!used[to] && dfs1(to)) ans = true;
  }
  return ans;
}
bool dfs2(int v, int prev) {
  used2[v] = true;
  path.push_back(v);
  c_x[v] = !c_x[v];
  for (int i = 0; i < (int)g[v].size(); ++i) {
    int to = g[v][i];
    if (!used2[to]) {
      dfs2(to, v);
      path.push_back(v);
      c_x[v] = !c_x[v];
    }
  }
  if (c_x[v] != x[v] && prev != -1) {
    path.push_back(prev);
    path.push_back(v);
    c_x[prev] = !c_x[prev];
    c_x[v] = !c_x[v];
  }
  if (prev == -1) return c_x[v] != x[v];
  return false;
}
int main() {
  int n, m, u, v;
  cin >> n >> m;
  g.resize(n);
  used.resize(n, false);
  c_x.resize(n, false);
  x.resize(n);
  for (int i = 0; i < m; ++i) {
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; ++i) {
    int j;
    cin >> j;
    x[i] = (j == 1);
  }
  int comp = -1;
  for (int i = 0; i < n; ++i) {
    if (!used[i] && comp == -1) {
      if (dfs1(i)) comp = i;
    } else if (!used[i] && dfs1(i)) {
      cout << -1 << endl;
      return 0;
    }
  }
  if (comp == -1) {
    cout << 0 << endl;
    return 0;
  }
  used2.resize(n, false);
  int start = dfs2(comp, -1);
  cout << path.size() - start << endl;
  for (int i = start; i < (int)path.size(); ++i) {
    cout << path[i] + 1 << ' ';
  }
}
