#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, u, v; cin >> n >> m; vector A(n), S(n); for(auto &&v : A) cin >> v; for(int i = 0; i < m; i++){ cin >> u >> v; u--, v--; S[u] |= 1 << v; S[v] |= 1 << u; } for(int U = 0; U < (1 << n); U++){ bool flg = true; for(int j = 0; j < n; j++){ if(__builtin_popcount(S[j] & U) != A[j]){ flg = false; break; } } if(flg){ cout << "Yes\n"; for(int j = 0; j < n; j++){ cout << (U >> j & 1) << (j + 1 == n ? '\n' : ' '); } return 0; } } cout << "No\n"; }