#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int ma;
int a[111], b[111], v[111][111];
int main() {
  scanf("%d%d", &n, &m);
  ma = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%d", &v[i][j]);
      ma = max(ma, v[i][j]);
    }
    a[i] = v[i][0];
  }
  k = 2000000000;
  b[0] = 0;
  for (int j = 1; j < m; j++) b[j] = v[0][j] - v[0][j - 1];
  for (int i = 0; i < n; i++)
    for (int j = 1; j < m; j++) {
      int x = v[i][j] - v[i][j - 1];
      if (x != b[j]) {
        if (b[j] < 0 && x > 0) k = x - b[j];
        if (b[j] > 0 && x < 0) k = b[j] - x;
      }
    }
  if (k <= ma || k <= 0)
    printf("NO\n");
  else {
    bool chk = true;
    for (int i = 0; i < m; i++) {
      b[i] %= k;
      if (b[i] < 0) b[i] += k;
    }
    for (int i = 0; i < n && chk; i++)
      for (int j = 1; j < m && chk; j++)
        if (v[i][j] != (1LL * v[i][j - 1] + b[j]) % k) chk = false;
    if (chk == false)
      printf("NO\n");
    else {
      printf("YES\n%d\n", k);
      for (int i = 0; i < n; i++) printf("%d%c", a[i], i < n - 1 ? ' ' : '\n');
      for (int i = 0; i < m; i++) {
        if (i) b[i] = (1LL * b[i] + b[i - 1]) % k;
        printf("%d%c", b[i], i < m - 1 ? ' ' : '\n');
      }
    }
  }
  return 0;
}
