#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200;
int N, M;
long long A[MAXN][MAXN];
long long MOD = -1;
vector<int> vec;
void out() {
  printf("NO\n");
  exit(0);
}
void checkvec() {
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  if (vec.size() > 2) out();
  if (vec[0] > 0 && vec.size() == 2) out();
  if (vec.size() == 2 && MOD != -1 && vec[1] - vec[0] != MOD) out();
  if (vec.size() == 2) MOD = vec[1] - vec[0];
}
void checkA(int x, int y) {
  vec.clear();
  for (int i = 0; i < N; ++i) vec.push_back(A[i][y] - A[i][x]);
  checkvec();
}
void checkB(int x, int y) {
  vec.clear();
  for (int i = 0; i < M; ++i) vec.push_back(A[y][i] - A[x][i]);
  checkvec();
}
long long a[MAXN];
long long b[MAXN];
int main(void) {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < M; ++j) scanf("%I64d", &A[i][j]);
  for (int i = 0; i < M; ++i)
    for (int j = i + 1; j < M; ++j) checkA(i, j);
  for (int i = 0; i < N; ++i)
    for (int j = i + 1; j < N; ++j) checkB(i, j);
  if (MOD == -1) MOD = 1000000000LL * 1000000000LL;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < M; ++j)
      if (A[i][j] >= MOD) out();
  printf("YES\n");
  printf("%I64d\n", MOD);
  a[0] = 0;
  b[0] = A[0][0];
  for (int i = 1; i < M; ++i) {
    b[i] = A[0][i] - A[0][i - 1] + b[i - 1];
    b[i] = (b[i] % MOD + MOD) % MOD;
  }
  for (int i = 1; i < N; ++i) {
    a[i] = A[i][0] - A[i - 1][0] + a[i - 1];
    a[i] = (a[i] % MOD + MOD) % MOD;
  }
  for (int i = 0; i < N; ++i) printf("%I64d ", a[i]);
  printf("\n");
  for (int i = 0; i < M; ++i) printf("%I64d ", b[i]);
  printf("\n");
  return 0;
}
