#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const long long INF = 1e18;
int n, m;
long long k;
long long a[MAXN], b[MAXN];
int v[MAXN][MAXN];
void solve() {
  k = INF;
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (m); ++j) scanf("%d", &v[i][j]);
  for (int j = (1); j < (m); ++j) {
    int x1 = 0, x2 = 0;
    for (int i = (1); i <= (n); ++i) {
      if (v[i][j] > v[i][j + 1]) x1 = i;
      if (v[i][j] < v[i][j + 1]) x2 = i;
      if (v[i][j] > v[i][j + 1] && x2)
        k = v[i][j] - v[i][j + 1] + v[x2][j + 1] - v[x2][j];
      if (v[i][j] < v[i][j + 1] && x1)
        k = v[i][j + 1] - v[i][j] + v[x1][j] - v[x1][j + 1];
    }
  }
  a[1] = 1;
  b[1] = (v[1][1] - a[1] + k) % k;
  for (int i = (2); i <= (n); ++i) a[i] = (a[1] + v[i][1] - v[1][1] + k) % k;
  for (int i = (2); i <= (m); ++i) b[i] = (b[1] + v[1][i] - v[1][1] + k) % k;
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (m); ++j)
      if (v[i][j] != (a[i] + b[j]) % k) {
        printf("NO\n");
        return;
      }
  printf("YES\n");
  printf("%I64d\n", k);
  for (int i = (1); i <= (n); ++i) printf("%I64d%c", a[i], i < n ? ' ' : '\n');
  for (int i = (1); i <= (m); ++i) printf("%I64d%c", b[i], i < m ? ' ' : '\n');
}
int main() {
  while (~scanf("%d%d", &n, &m)) solve();
  return 0;
}
