#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e17;
long long n, m;
void yes(long long k, vector<long long> &a, vector<long long> &b) {
  cout << "YES\n";
  cout << k << '\n';
  for (long long i = 0; i < n; ++i)
    cout << (a[i] % k + k) % k << " \n"[i == n - 1];
  for (long long j = 0; j < m; ++j)
    cout << (b[j] % k + k) % k << " \n"[j == m - 1];
  exit(0);
}
void no() {
  cout << "NO\n";
  exit(0);
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin >> n >> m;
  vector<vector<long long> > grid(n, vector<long long>(m));
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < m; ++j) cin >> grid[i][j];
  vector<long long> a(n), b(m);
  a[0] = 0;
  for (long long j = 0; j < m; ++j) b[j] = grid[0][j];
  for (long long i = 1; i < n; ++i) a[i] = grid[i][0] - b[0];
  vector<long long> diffs;
  for (long long i = 0; i < n; ++i)
    for (long long j = 0; j < m; ++j)
      if (a[i] + b[j] != grid[i][j])
        diffs.push_back(abs(a[i] + b[j] - grid[i][j]));
  if (diffs.size() == 0)
    yes(inf, a, b);
  else {
    long long g = diffs[0];
    for (long long i = 1; i < diffs.size(); ++i) {
      g = gcd(g, diffs[i]);
    }
    bool ok = true;
    for (long long i = 0; i < n; ++i)
      for (long long j = 0; j < m; ++j)
        if (g <= grid[i][j]) ok = false;
    if (!ok)
      no();
    else
      yes(g, a, b);
  }
}
