#include <bits/stdc++.h>
using namespace std;
bool cap[100002];
bool forbid_cap[100002];
vector<int> adj[100002];
bool capitalize(int v) {
  if (forbid_cap[v]) return false;
  cap[v] = true;
  for (auto neighbor : adj[v]) {
    if (!cap[neighbor]) {
      if (!capitalize(neighbor)) return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string ans = "Yes";
  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(n);
  int cnt, tmp;
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> cnt;
    for (long long int j = 0; j <= cnt - 1; j++) {
      cin >> tmp;
      v[i].push_back(tmp);
    }
  }
  for (long long int i = 0; i <= n - 1 - 1; i++) {
    vector<int> &a = v[i];
    vector<int> &b = v[i + 1];
    int a_size = a.size();
    int b_size = b.size();
    int min_size = min(a_size, b_size);
    int j = 0;
    while (j < min_size) {
      if (a[j] < b[j]) {
        if (cap[b[j]] && !capitalize(a[j]))
          ans = "No";
        else
          adj[b[j]].push_back(a[j]);
        break;
      } else if (a[j] > b[j]) {
        if (cap[b[j]])
          ans = "No";
        else {
          forbid_cap[b[j]] = true;
          if (!capitalize(a[j])) ans = "No";
        }
        break;
      }
      j++;
    }
    if (j == min_size && a_size > b_size) {
      ans = "No";
    }
    if (ans == "No") break;
  }
  if (ans == "No") {
    cout << ans << "\n";
  } else {
    cout << ans << "\n";
    vector<int> ans_vec;
    for (long long int i = 1; i <= m; i++) {
      if (cap[i]) ans_vec.push_back(i);
    }
    cout << ans_vec.size() << "\n";
    for (auto i : ans_vec) cout << i << " ";
  }
  return 0;
}
