#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const double eps = 0.00000000001, eps2 = 0.0001;
const int INF = (int)1e9;
const long long LINF = 1e16;
const double Pi = acos(-1.0);
int n, m;
int used[N], capital[N];
vector<int> w[N], g[N];
bool ok = 1;
void cmp(int i) {
  int l1 = w[i].size(), l2 = w[i + 1].size();
  for (int j = 0; j < min(l1, l2); j++) {
    int d1 = w[i][j], d2 = w[i + 1][j];
    if (d1 != d2) {
      g[d2].push_back(d1);
      return;
    }
  }
  if (l1 > l2) ok = 0;
}
void dfs(int cur) {
  for (int i = 0; i < g[cur].size(); i++) {
    int to = g[cur][i];
    if (to > cur) {
      capital[to] = 1;
    }
  }
}
void dfs2(int cur) {
  used[cur] = 1;
  for (int i = 0; i < g[cur].size(); i++) {
    int to = g[cur][i];
    if (used[to]) {
      continue;
    }
    if (to > cur || capital[cur]) {
      capital[to] = 1;
    }
    dfs2(to);
  }
}
void cheque(int i) {
  int l1 = w[i].size(), l2 = w[i + 1].size();
  for (int j = 0; j < min(l1, l2); j++) {
    int d1 = w[i][j], d2 = w[i + 1][j];
    if (d1 != d2) {
      if (d1 < d2 && capital[d1] == capital[d2] ||
          capital[d1] && !capital[d2]) {
        return;
      }
      ok = 0;
      return;
    }
  }
  if (l1 > l2) ok = 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    int l;
    scanf("%d", &l);
    for (int j = 0; j < l; j++) {
      int next;
      scanf("%d", &next);
      w[i].push_back(--next);
    }
  }
  for (int i = 0; i < n - 1; i++) {
    cmp(i);
  }
  for (int i = 0; i < m; i++) {
    dfs(i);
  }
  for (int i = 0; i < m; i++) {
    if (capital[i]) dfs2(i);
  }
  for (int i = 0; i < n - 1; i++) {
    cheque(i);
  }
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    if (capital[i]) {
      cnt++;
    }
  }
  if (ok) {
    printf("Yes\n");
    printf("%d\n", cnt);
    for (int i = 0; i < m; i++) {
      if (capital[i]) {
        printf("%d ", i + 1);
      }
    }
  } else {
    printf("No");
  }
}
