#include <bits/stdc++.h>
using namespace std;
long long D[105][105];
long long A[105], B[105];
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int N, M;
  long long mx = 0;
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      scanf("%lld", D[i] + j);
      mx = max(mx, D[i][j]);
    }
  }
  A[1] = 0;
  for (int i = 1; i <= M; i++) B[i] = D[1][i];
  for (int i = 1; i <= N; i++) A[i] = D[i][1] - B[1];
  if (A[1] != 0) printf("ERR\n");
  long long G = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (A[i] + B[j] == D[i][j]) continue;
      G = gcd(abs(D[i][j] - A[i] - B[j]), G);
    }
  }
  if (G == 0) G = 1000000007;
  if (G <= mx)
    printf("NO\n");
  else {
    printf("YES\n%d\n", G);
    for (int i = 1; i <= N; i++) printf("%d ", (A[i] % G + G) % G);
    printf("\n");
    for (int j = 1; j <= M; j++) printf("%d ", (B[j] % G + G) % G);
  }
  return 0;
}
