#include <bits/stdc++.h>
using namespace std;
bool isLeaf[100001] = {0};
bool isCorrect[100001] = {0};
bool nowCorrect[100001] = {0};
bool allVisited[100001] = {0};
bool visited = false;
vector<int> solution;
vector<vector<int> > old_pony_ville, pony_ville;
bool dfs(int nodo) {
  if (!isLeaf[nodo]) {
    solution.push_back(nodo);
    nowCorrect[nodo] = !nowCorrect[nodo];
    for (int i = 0; i < pony_ville[nodo].size(); i++) {
      do {
        visited = dfs(pony_ville[nodo][i]);
      } while (!isLeaf[pony_ville[nodo][i]]);
      if (visited) {
        solution.push_back(nodo);
        nowCorrect[nodo] = !nowCorrect[nodo];
        if (!allVisited[pony_ville[nodo][i]]) {
          visited = dfs(pony_ville[nodo][i]);
          if (visited) {
            solution.push_back(nodo);
            nowCorrect[nodo] = !nowCorrect[nodo];
          }
        }
      }
    }
    isLeaf[nodo] = true;
    return true;
  } else {
    allVisited[nodo] = true;
    if (nowCorrect[nodo] == isCorrect[nodo])
      return false;
    else {
      nowCorrect[nodo] = !nowCorrect[nodo];
      solution.push_back(nodo);
      return true;
    }
  }
}
void MST(int start) {
  bool isVisited[100001] = {0};
  vector<int> visits;
  visits.push_back(start);
  while (!visits.empty()) {
    start = visits.back();
    isVisited[start] = true;
    visits.pop_back();
    for (int i = 0; i < old_pony_ville[start].size(); i++) {
      if (!isVisited[old_pony_ville[start][i]]) {
        pony_ville[start].push_back(old_pony_ville[start][i]);
        visits.push_back(old_pony_ville[start][i]);
        isVisited[old_pony_ville[start][i]] = true;
      }
    }
  }
}
int main() {
  int n, m, a, b, start = 0;
  bool x;
  cin >> n >> m;
  n++;
  old_pony_ville.resize(n);
  pony_ville.resize(n);
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    old_pony_ville[a].push_back(b);
    old_pony_ville[b].push_back(a);
  }
  for (int i = 1; i < n; i++) {
    cin >> x;
    if (x) start = i;
    isCorrect[i] = x;
  }
  MST(start);
  for (int i = 1; i < n; i++) {
    if (pony_ville[i].size() == 0) isLeaf[i] = true;
  }
  dfs(start);
  allVisited[start] = true;
  if (nowCorrect[start] != isCorrect[start]) solution.pop_back();
  for (int i = 1; i < n; i++) {
    if (!allVisited[i] && isCorrect[i]) {
      cout << -1;
      return 0;
    }
  }
  cout << solution.size() << endl;
  for (int i = 0; i < solution.size(); i++) {
    cout << solution[i] << " ";
  }
  return 0;
}
