#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while ((c < '0') || (c > '9')) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ((c >= '0') && (c <= '9'))
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
const int maxn = 100005;
vector<int> val[maxn], ans;
int n, m, len[maxn];
int col[maxn];
bool res = 1;
vector<int> E[maxn];
int update(int x, bool y) {
  if (col[x] == -1)
    return col[x] = y, 1;
  else
    return col[x] == y ? 2 : 0;
}
void dfs(int u) {
  for (int i = 0, iend = (int)E[u].size() - 1; i <= iend; ++i) {
    int v = E[u][i], t = update(v, 0);
    if (!t)
      res = 0;
    else if (t == 1)
      dfs(v);
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1, iend = m; i <= iend; ++i) col[i] = -1;
  for (int i = 1, iend = n; i <= iend; ++i) {
    len[i] = read();
    for (int j = 0, jend = len[i] - 1; j <= jend; ++j) val[i].push_back(read());
  }
  for (int i = 1, iend = n - 1; i <= iend; ++i) {
    for (int j = 0, jend = len[i] - 1; j <= jend; ++j) {
      if (len[i + 1] <= j) {
        res = 0;
        break;
      }
      if (val[i][j] != val[i + 1][j]) {
        if (val[i][j] > val[i + 1][j]) {
          if (!update(val[i][j], 0)) res = 0;
          if (!update(val[i + 1][j], 1)) res = 0;
        } else
          E[val[i + 1][j]].push_back(val[i][j]);
        break;
      }
    }
  }
  for (int i = 1, iend = m; i <= iend; ++i)
    if (col[i] == 0) dfs(i);
  puts(res ? "Yes" : "No");
  if (res) {
    for (int i = 1, iend = m; i <= iend; ++i)
      if (col[i] == 0) ans.push_back(i);
    printf("%d\n", ans.size());
    for (int i = 0, iend = (int)ans.size() - 1; i <= iend; ++i)
      printf("%d%c", ans[i], i == iend ? '\n' : ' ');
  }
  return 0;
}
