#include <bits/stdc++.h>
using namespace std;
const int maxn = 111111;
vector<int> vec[2];
vector<int> graph[maxn];
int d[maxn];
bool b[maxn];
int q[maxn];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  int cur = 0;
  vec[cur].clear();
  memset(d, 0, sizeof(d));
  for (int i = 0; i < n; ++i) {
    int h;
    scanf("%d", &h);
    cur = 1 - cur;
    vec[cur].clear();
    bool equal = true;
    int u = 0, v = 0;
    for (int j = 0; j < h; ++j) {
      int x;
      scanf("%d", &x);
      vec[cur].push_back(x);
      if (!equal) continue;
      if ((int)vec[1 - cur].size() <= j) continue;
      if (vec[1 - cur][j] != x) {
        equal = false;
        u = x;
        v = vec[1 - cur][j];
      }
    }
    if (equal) {
      if ((int)vec[1 - cur].size() > h) {
        printf("No\n");
        return 0;
      }
    }
    if (u != 0) {
      graph[u].push_back(v);
      ++d[v];
    }
  }
  int l = 1, r = 0;
  for (int i = 1; i <= m; ++i) {
    if (d[i] == 0) {
      q[++r] = i;
    }
  }
  memset(b, false, sizeof(b));
  bool ok = true;
  while (l <= r) {
    int now = q[l];
    for (int i = 0; i < (int)graph[now].size(); ++i) {
      int k = graph[now][i];
      if (now < k) {
        if (b[now]) {
          ok = false;
        } else {
          b[k] = true;
        }
      } else {
        if (b[now]) {
          b[k] = true;
        }
      }
      --d[k];
      if (d[k] == 0) {
        q[++r] = k;
      }
    }
    ++l;
  }
  if ((r != m) || !ok) {
    printf("No\n");
  } else {
    printf("Yes\n");
    int num = 0;
    for (int i = 1; i <= m; ++i) {
      if (b[i]) ++num;
    }
    printf("%d\n", num);
    for (int i = 1; i <= m; ++i)
      if (b[i]) printf("%d ", i);
    if (num > 0) printf("\n");
  }
  return 0;
}
