#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int visit[N];
int a[N], b[N * 4];
vector<int> G[N];
vector<int> G2[N];
int idx;
void dfs(int pos, int p) {
  b[idx++] = pos;
  visit[pos] ^= 1;
  for (auto v : G2[pos]) {
    dfs(v, pos);
    visit[pos] ^= 1;
    if (visit[v] != a[v]) {
      b[idx++] = v;
      b[idx++] = pos;
      visit[v] ^= 1;
      visit[pos] ^= 1;
    }
  }
  if (p > 0) b[idx++] = p;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = (0); i < (int)(m); ++i) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  for (int i = (1); i < (int)(n + 1); ++i) cin >> a[i];
  int cnt = 0, start = 0;
  for (int i = (1); i < (int)(n + 1); ++i) {
    if (visit[i]) continue;
    bool one = false;
    queue<int> q;
    q.push(i);
    visit[i] = 1;
    while (!q.empty()) {
      int pos = q.front();
      q.pop();
      if (a[pos]) one = true;
      for (auto v : G[pos]) {
        if (visit[v]) continue;
        G2[pos].push_back(v);
        visit[v] = 1;
        q.push(v);
      }
    }
    if (one) ++cnt, start = i;
  }
  if (cnt > 1) {
    cout << -1 << endl;
    return 0;
  }
  if (!cnt) {
    cout << 0 << endl;
    return 0;
  }
  memset(visit, 0, sizeof(visit));
  dfs(start, -1);
  int x = visit[start] != a[start];
  bool f = false;
  cout << idx - x << endl;
  for (int i = (x); i < (int)(idx); ++i) {
    if (f) cout << " ";
    f = true;
    cout << b[i];
  }
  cout << endl;
  return 0;
}
