#include <bits/stdc++.h>
using namespace std;
vector<int> adjList[100005];
vector<int> nodesTaken;
int visited[100005];
int onPath[100005];
int parents[100005];
int kind[100005];
int arr[100005];
int size = 0;
int n, m;
int parent(int value) {
  if (value == arr[value])
    return value;
  else
    return (arr[value] = parent(arr[value]));
}
bool checkUnion(int value1, int value2) {
  if (parent(value1) == parent(value2)) return true;
  return false;
}
void Union(int j, int i) {
  int findParent = parent(i);
  int findParentJ = parent(j);
  arr[findParent] = findParentJ;
}
void dfs(int node, int parent, bool successor) {
  nodesTaken.push_back(node);
  visited[node] = true;
  parents[node] = parent;
  onPath[node]++;
  for (int i = 0; i < (int)adjList[node].size(); i++) {
    int v = adjList[node][i];
    if (!visited[v]) {
      bool condition = false;
      if ((i < adjList[node].size() - 1 && adjList[node].size() > 2) ||
          (i < adjList[node].size() - 1 && adjList[node].size() > 1 &&
           parent == -1)) {
        condition = true;
      }
      dfs(v, node, condition | successor);
      nodesTaken.push_back(node);
      onPath[node]++;
    }
  }
  if (parent != -1) {
    if (kind[node] == 0 && onPath[node] % 2 == 1 ||
        kind[node] == 1 && onPath[node] % 2 == 0) {
      nodesTaken.push_back(parent);
      onPath[parent]++;
      nodesTaken.push_back(node);
      onPath[node]++;
    }
  } else {
    if (kind[node] != onPath[node] % 2) {
      size = nodesTaken.size() - 1;
    } else {
      size = nodesTaken.size();
    }
  }
}
int main() {
  cin >> n >> m;
  int all = 0;
  int index = 1;
  for (int i = 1; i <= n; i++) {
    arr[i] = i;
    onPath[i] = 0;
    parents[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    if (!checkUnion(a, b)) {
      Union(a, b);
      adjList[a].push_back(b);
      adjList[b].push_back(a);
    }
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &kind[i]);
    if (kind[i] == 1) {
      all++;
      if (all == 1) index = i;
    }
  }
  if (all == 0) {
    cout << 0 << endl;
    return 0;
  }
  if (all > 1 && m == 0) {
    cout << -1 << endl;
    return 0;
  }
  dfs(index, -1, false);
  for (int i = 1; i <= n; i++) {
    if (kind[i] == 1 && !visited[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << size << endl;
  for (int i = 0; i < size; i++) {
    cout << nodesTaken[i] << " ";
  }
  cout << endl;
  return 0;
}
