#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& stream, const vector<T> v) {
  stream << "[";
  for (int i = 0; i < (int)v.size(); i++) cout << v[i] << " ";
  stream << "]";
  return stream;
}
long long fpow(long long x, long long p, long long m) {
  long long r = 1;
  for (; p >>= 1;) {
    if (p & 1) r = r * x % m;
    x = x * x % m;
  }
  return r;
}
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int N, M, l[100100], c[200100], st[200100], K, C;
vector<int> s[100100];
vector<int> g[200100], gc[200100];
bool v[200100];
int id(int x) { return (x > 0 ? x : M - x); }
void add_edge(int x, int y) {
  g[id(-x)].push_back(id(y));
  gc[id(y)].push_back(id(-x));
  g[id(-y)].push_back(id(x));
  gc[id(x)].push_back(id(-y));
}
void dfs1(int nod) {
  v[nod] = 1;
  for (int nxt : g[nod])
    if (!v[nxt]) dfs1(nxt);
  st[++K] = nod;
}
void dfs2(int nod) {
  c[nod] = C;
  for (int nxt : gc[nod])
    if (c[nxt] == 0) dfs2(nxt);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> M;
  int i, j, x, k;
  for (i = 1; i <= N; i++) {
    cin >> l[i];
    for (j = 1; j <= l[i]; j++) {
      cin >> x;
      s[i].push_back(x);
    }
  }
  bool pos = 1;
  for (k = 1; k < N; k++) {
    bool g = 0;
    for (i = 0; i < min(l[k], l[k + 1]); i++) {
      if (s[k][i] == s[k + 1][i])
        continue;
      else if (s[k][i] < s[k + 1][i]) {
        g = 1;
        add_edge(s[k][i], -s[k + 1][i]);
        break;
      } else {
        add_edge(s[k][i], s[k][i]);
        add_edge(-s[k + 1][i], -s[k + 1][i]);
        g = 1;
        break;
      }
    }
    if (!g && l[k] > l[k + 1]) {
      pos = 0;
      break;
    }
  }
  if (!pos) {
    cout << "No\n";
    return 0;
  }
  for (i = 1; i <= 2 * M; i++)
    if (!v[i]) dfs1(i);
  for (i = 2 * M; i > 0; i--)
    if (c[st[i]] == 0) {
      C++;
      dfs2(st[i]);
    }
  vector<int> ans;
  for (i = 1; i <= M; i++) {
    if (c[i] == c[M + i]) pos = 0;
    if (c[i] > c[M + i]) ans.push_back(i);
  }
  if (!pos) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  cout << ans.size() << "\n";
  for (int x : ans) cout << x << " ";
  return 0;
}
