#include <bits/stdc++.h>
using namespace std;
int A[100 + 5][100 + 5];
long long a[100 + 5], b[100 + 5];
long long M;
bool check(int n, int m) {
  for (int i = 2; i <= n; i++) {
    int diff = 0x3f3f3f3f;
    for (int j = 1; j <= m; j++) {
      int t = A[i][j] - A[i - 1][j];
      if (diff == 0x3f3f3f3f)
        diff = t;
      else if (diff != t) {
        if (1ll * diff * t >= 0) return 0;
        if (M == 0) {
          M = abs(diff) + abs(t);
        } else if (M != abs(diff) + abs(t))
          return 0;
      }
    }
    a[i] = diff;
  }
  for (int j = 2; j <= m; j++) {
    int diff = 0x3f3f3f3f;
    for (int i = 1; i <= n; i++) {
      int t = A[i][j] - A[i][j - 1];
      if (diff == 0x3f3f3f3f)
        diff = t;
      else if (diff != t) {
        if (1ll * diff * t >= 0) return 0;
        if (M == 0) {
          M = abs(diff) + abs(t);
        } else if (M != abs(diff) + abs(t))
          return 0;
      }
    }
    b[j] = diff;
  }
  b[1] = A[1][1];
  if (M == 0) M = 1ll << 40;
  for (int i = 2; i <= n; i++) a[i] = a[i - 1] + (a[i] < 0 ? M + a[i] : a[i]);
  for (int i = 2; i <= m; i++) b[i] = b[i - 1] + (b[i] < 0 ? M + b[i] : b[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if ((a[i] + b[j]) % M != A[i][j]) return 0;
  return 1;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%d", &A[i][j]);
  bool f = check(n, m);
  if (f == 0)
    puts("NO");
  else {
    puts("YES");
    printf("%I64d\n", M);
    for (int i = 1; i <= n; i++) printf("%I64d%c", a[i], " \n"[i == n]);
    for (int i = 1; i <= m; i++) printf("%I64d%c", b[i], " \n"[i == m]);
  }
  return 0;
}
