#include <bits/stdc++.h>
using namespace std;
FILE *in, *out;
int N, M, K;
vector<int> pre;
vector<int> cur;
int have[200100];
int nothave[200100];
vector<vector<int> > edges(200100);
int add() {
  int i, j, k;
  int ps = (int)(pre.size()), cs = (int)(cur.size());
  for (i = 0; i < min(ps, cs); i++) {
    if (pre[i] == cur[i]) continue;
    if (pre[i] < cur[i]) {
      edges[cur[i]].push_back(pre[i]);
    } else {
      if (nothave[pre[i]]) {
        cout << "No\n";
        exit(0);
      }
      have[pre[i]] = 1;
      if (have[cur[i]]) {
        cout << "No\n";
        exit(0);
      }
      nothave[cur[i]] = 1;
    }
    return 0;
  }
  if (ps > cs) {
    cout << "No\n";
    exit(0);
  }
  return 0;
}
int ans;
int used[200100];
int dfs(int root) {
  used[root] = 1;
  have[root] = 1;
  int i, j, k;
  for (i = 0; i < (int)(edges[root].size()); i++) {
    if (nothave[edges[root][i]]) {
      cout << "No\n";
      exit(0);
    }
    if (used[edges[root][i]]) continue;
    dfs(edges[root][i]);
  }
  return 0;
}
int read() {
  int i, j, k;
  int x, y;
  cin >> N >> M;
  cin >> x;
  for (i = 0; i < x; i++) {
    cin >> y;
    pre.push_back(y);
  }
  for (i = 1; i < N; i++) {
    cin >> x;
    cur.clear();
    for (j = 0; j < x; j++) {
      cin >> y;
      cur.push_back(y);
    }
    add();
    pre = cur;
  }
  for (i = 1, j = 0; i <= M; i++) {
    if (have[i]) dfs(i);
  }
  for (i = 1, j = 0; i <= M; i++) {
    if (have[i]) ans++;
  }
  cout << "Yes\n" << ans << "\n";
  for (i = 1; i <= M; i++)
    if (have[i]) cout << i << " ";
  cout << "\n";
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  in = stdin;
  out = stdout;
  read();
  return 0;
}
