#include <bits/stdc++.h>
using namespace std;
int s[100010], a[100010], b[100010], n, m, t;
vector<int> v[100010];
int Update_upper(int x) {
  if (!t) return 0;
  for (int i = 0; i < v[x].size(); i++)
    if (s[v[x][i]] == 2)
      return t = 0;
    else if (!s[v[x][i]])
      s[v[x][i]] = 1, Update_upper(v[x][i]);
  return 0;
}
int main() {
  int x, y;
  scanf("%d%d%d", &n, &m, &x);
  for (int i = 1; i <= x; i++) scanf("%d", &a[i]);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &y);
    bool unequal = false;
    for (int j = 1; j <= y; j++) scanf("%d", &b[j]);
    for (int j = 1; j <= min(x, y); j++) {
      int &p = s[(a[j] + m * (a[j] <= 0))], &q = s[(b[j] + m * (b[j] <= 0))];
      if (p == 1 && a[j] > 0) a[j] -= m;
      if (q == 1 && b[j] > 0) b[j] -= m;
      if (a[j] == b[j]) continue;
      if (a[j] < b[j]) {
        unequal = true;
        if (p == 2)
          q = 2;
        else if (p == 1) {
          if (!q && b[j] - m < a[j]) q = 2;
        } else
          v[b[j]].push_back(a[j]);
      } else {
        unequal = true;
        if (p) {
          printf("No\n");
          return 0;
        } else {
          t = 1;
          p = 1;
          Update_upper(a[j]);
          if (!t) {
            printf("No\n");
            return 0;
          }
          if (a[j] > 0) a[j] -= m;
          if (q == 1 && b[j] > 0) b[j] -= m;
          if (a[j] > b[j]) {
            printf("No\n");
            return 0;
          }
          if (!q && b[j] - m < a[j]) q = 2;
        }
      }
      break;
    }
    if (!unequal && x > y) {
      printf("No\n");
      return 0;
    }
    for (int j = 1; j <= y; j++) a[j] = b[j];
    x = y;
  }
  int cnt = 0;
  for (int i = 1; i <= m; i++)
    if (s[i] == 1) cnt++;
  printf("Yes\n%d\n", cnt);
  for (int i = 1; i <= m; i++)
    if (s[i] == 1) printf("%d ", i);
  printf("\n");
  return 0;
}
