#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e2 + 2;
const long long INF = 1e9 + 2;
const long long MOD = 1e9 + 7;
long long k = -1, mx = 1, n, m, mat[maxn][maxn], a[maxn], b[maxn];
int main() {
  cin >> n >> m;
  fill(a + 1, a + n + 1, -1);
  fill(b + 1, b + m + 1, -1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> mat[i][j];
      mx = max(mx, mat[i][j] + 1);
    }
  a[1] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i] > -1 && b[j] > -1) {
        if (a[i] + b[j] != mat[i][j]) {
          if (k != -1 && ((a[i] + b[j]) % k) != mat[i][j])
            return cout << "NO", 0;
          else if (k == -1) {
            k = a[i] + b[j] - mat[i][j];
            if (k < mx) return cout << "NO", 0;
          }
        }
      } else if (a[i] > -1)
        if ((mat[i][j] - a[i]) >= 0)
          b[j] = mat[i][j] - a[i];
        else {
          if (k == -1) k = mx;
          b[j] = ((mat[i][j] + k - a[i]) % k);
        }
      else if ((mat[i][j] - b[j]) >= 0)
        a[i] = mat[i][j] - b[j];
      else {
        if (k == -1) k = mx;
        a[i] = ((mat[i][j] + k - b[j]) % k);
      }
    }
  }
  if (k == -1) k = mx;
  printf("YES\n%I64d\n", k);
  for (int i = 1; i <= n; i++) printf("%I64d ", a[i]);
  printf("\n");
  for (int i = 1; i <= m; i++) printf("%I64d ", b[i]);
  return 0;
}
