#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
bool over(long long a, long long b) { return (a * b) / b != a; }
int no() {
  puts("NO");
  return 0;
}
int main() {
  int n, m;
  cin >> n >> m;
  int mat[100][100];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> mat[i][j];
    }
  }
  int a[100], b[100] = {0};
  for (int i = 0; i < n; i++) {
    a[i] = mat[i][0];
  }
  for (int i = 1; i < m; i++) {
    b[i] = -1;
  }
  int k = -1;
  for (int j = 1; j < m; j++) {
    for (int i = 0; i < n; i++) {
      int d = mat[i][j] - mat[i][0];
      if (mat[i][0] <= mat[i][j]) {
        if (b[j] != -1) {
          if (d != b[j]) {
            return no();
          }
        } else {
          b[j] = mat[i][j] - mat[i][0];
        }
      } else {
        if (b[j] != -1) {
          int nk = a[i] + b[j] - mat[i][j];
          if (k == -1) {
            k = nk;
          } else {
            if (k != nk) {
              return no();
            }
          }
        }
      }
    }
  }
  if (k == -1) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) k = max(k, mat[i][j] + 1);
  }
  for (int j = 0; j < m; j++) {
    int q = -1;
    for (int i = 0; i < n; i++) {
      if (b[j] == -1) {
        int nb = k + mat[i][j] - a[i];
        if (q == -1)
          q = nb;
        else {
          if (q != nb) {
            return no();
          }
        }
      }
    }
    if (q != -1) b[j] = q;
    for (int i = 0; i < n; i++) {
      if ((a[i] + b[j]) % k != mat[i][j]) {
        return no();
      }
    }
  }
  puts("YES");
  printf("%d\n", k);
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  for (int i = 0; i < m; i++) {
    cout << b[i] << " ";
  }
  cout << endl;
  return 0;
}
