#include <bits/stdc++.h>
using namespace std;
const int N = 110;
long long a[N][N], n, m;
long long b[N], c[N], k, fd;
long long solve(set<long long> dif) {
  if (dif.size() >= 3) {
    return -1;
  }
  if (dif.size() == 2) {
    set<long long>::iterator it = dif.begin();
    long long a = *it;
    ++it;
    long long b = *it;
    if (((a > 0) == (b > 0)) && a != b) {
      return -1;
    } else if ((a > 0) != (b > 0)) {
      k = max(a, -a) + max(b, -b);
      fd = 1;
      return 1;
    }
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> m >> n;
  for (long long i = 1; i <= m; ++i)
    for (long long j = 1; j <= n; ++j) cin >> a[i][j];
  for (long long i = 2; i <= m; ++i) {
    set<long long> dif;
    for (long long j = 1; j <= n; ++j) dif.insert(a[i][j] - a[i - 1][j]);
    long long vl = solve(dif);
    if (vl == -1) {
      cout << "NO\n";
      return 0;
    }
    if (vl == 1) break;
  }
  if (fd == 0)
    for (long long j = 2; j <= n; ++j) {
      set<long long> dif;
      for (long long i = 1; i <= m; ++i) dif.insert(a[i][j] - a[i][j - 1]);
      long long vl = solve(dif);
      if (vl == -1) {
        cout << "NO\n";
        return 0;
      }
      if (vl == 1) break;
    }
  if (fd == 0) k = 1000000007;
  b[1] = 0;
  c[1] = a[1][1];
  for (long long i = 2; i <= m; ++i) {
    long long d = a[i][1] - a[i - 1][1];
    if (d < 0) d = d + k;
    b[i] = b[i - 1] + d;
  }
  for (long long i = 2; i <= n; ++i) {
    long long d = a[1][i] - a[1][i - 1];
    if (d < 0) d = d + k;
    c[i] = c[i - 1] + d;
  }
  for (long long i = 1; i <= m; ++i)
    for (long long j = 1; j <= n; ++j)
      if ((b[i] + c[j]) % k != a[i][j]) {
        cout << "NO\n";
        return 0;
      }
  cout << "YES\n";
  cout << k << '\n';
  for (long long i = 1; i <= m; ++i) cout << b[i] << ' ';
  cout << '\n';
  for (long long i = 1; i <= n; ++i) cout << c[i] << ' ';
  cout << '\n';
}
