#include <bits/stdc++.h>
using namespace std;
const int inf = 987654321;
const long long int INF = 123456789987654321;
FILE *fin, *fout;
int N, M;
vector<vector<int> > V;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  scanf("%d %d", &N, &M);
  V = vector<vector<int> >(N, vector<int>(M));
  int mx = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      scanf("%d", &V[i][j]);
      mx = max(mx, V[i][j]);
    }
  }
  int g = 0;
  for (int i = 0; i < N - 1; i++) {
    vector<int> D;
    for (int j = 0; j < M; j++) {
      D.push_back(V[i + 1][j] - V[i][j]);
    }
    for (int j = 0; j < (int)D.size() - 1; j++) {
      g = gcd(g, abs(D[j + 1] - D[j]));
    }
  }
  for (int i = 0; i < M - 1; i++) {
    vector<int> D;
    for (int j = 0; j < N; j++) {
      D.push_back(V[j][i + 1] - V[j][i]);
    }
    for (int j = 0; j < (int)D.size() - 1; j++) {
      g = gcd(g, abs(D[j + 1] - D[j]));
    }
  }
  if (g == 0) g = 1000000007;
  if (g <= mx) {
    printf("NO");
    return 0;
  }
  vector<int> a(N), b(M);
  a[0] = 0, b[0] = V[0][0];
  for (int i = 1; i < M; i++) {
    b[i] =
        ((long long int)V[0][i] - (long long int)a[0] + (long long int)g) % g;
  }
  for (int i = 1; i < N; i++) {
    a[i] =
        ((long long int)V[i][0] - (long long int)b[0] + (long long int)g) % g;
  }
  printf("YES\n%d\n", g);
  for (int i = 0; i < N; i++) printf("%d ", a[i]);
  printf("\n");
  for (int i = 0; i < M; i++) printf("%d ", b[i]);
}
