#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:1024000000,1024000000 )   const double pi = acos(-1.0), eps = 1e-8;   const int maxm = 1100000, inf = 0x3f3f3f3f;   bool f[maxm];   vector<int> v[maxm];   int top, st[maxm];   int a[maxm];   void dfs(int x, int pre) {     f[x] = true;     int i;     a[x] ^= 1;     st[top++] = x;     for (i = 0; i < v[x].size(); i++) {       if (f[v[x][i]] == false) {         dfs(v[x][i], x);         st[top++] = x;         a[x] ^= 1;       }     }     if (a[x] != 0 && pre != -1) {       st[top++] = pre;       a[pre] ^= 1;       st[top++] = x;       a[x] ^= 1;     }   }   int main() {     int n, m, i, x, y, begin;     while (scanf( %d%d , &n, &m) == 2) {       for (i = 1; i <= n; i++) v[i].clear();       while (m--) {         scanf( %d%d , &x, &y);         v[x].push_back(y);         v[y].push_back(x);       }       for (i = 1; i <= n; i++) {         scanf( %d , &a[i]);         f[i] = false;       }       top = 0;       for (i = 1; i <= n; i++) {         if (a[i] == 1) {           dfs(i, -1);           begin = i;           break;         }       }       if (i == n + 1) {         printf( 0 n );         continue;       }       for (i = begin + 1; i <= n; i++) {         if (a[i] != 0) {           printf( -1 n );           break;         }       }       if (i <= n) continue;       if (a[begin] == 1)         begin = 1;       else         begin = 0;       printf( %d n , top - begin);       for (i = begin; i < top; i++) {         printf( %d , st[i]);         if (i == top - 1)           printf(  n );         else           printf(   );       }     }     return 0;   }   