#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > nlist(n);
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int a;
      cin >> a;
      nlist[a - 1].push_back(i);
    }
  }
  bitset<10> bset;
  for (int i = 0; i < m; i++) {
    int b;
    cin >> b;
    if (b) {
      bset.set(i);
    }
  }
  cout << "yes" << endl;
  int cnt = 0;
  for (int i = 0; i < (1 << n); i++) {
    bitset<10> bset2;
    for (int j = 0; j < n; j++) {
      if (i >> j & 1) {
        for (int k = 0; k < nlist[j].size(); k++) {
          if (bset2[k]) {
            bset2.reset(k);
          } else {
            bset2.set(k);
          }
        }
      }
    }
    if (bset == bset2) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
