#include <bits/stdc++.h>
using namespace std;
const int INF = 987654321;
int get_max(const vector<vector<int> >& M) {
  int res = 0;
  for (auto e : M) res = max(res, *max_element(e.begin(), e.end()));
  return res;
}
int calc_gcd(int a, int b) {
  if (b > a) swap(a, b);
  if (b == 0) return a;
  return calc_gcd(b, a % b);
}
int calc_gcd(const vector<vector<int> >& M) {
  int res = M[0][0];
  for (auto vec : M)
    for (auto e : vec) res = calc_gcd(res, e);
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > V(n, vector<int>(m));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> V[i][j];
  vector<int> a(n), b(m);
  for (int j = 0; j < m; ++j) b[j] = V[0][j];
  for (int i = 0; i < n; ++i) a[i] = V[i][0] - b[0];
  vector<vector<int> > E(n, vector<int>(m));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) E[i][j] = abs(a[i] + b[j] - V[i][j]);
  int K;
  if (get_max(E) == 0) {
    K = get_max(V);
    ++K;
  } else {
    K = calc_gcd(E);
    if (K <= get_max(V)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (int i = 0; i < n; ++i)
    if (a[i] < 0) a[i] += K * ((abs(a[i]) + K - 1) / K);
  for (int j = 0; j < m; ++j)
    if (b[j] < 0) b[j] += K * ((abs(b[j]) + K - 1) / K);
  cout << "YES" << endl;
  cout << K << endl;
  for (auto e : a) cout << e << " ";
  cout << endl;
  for (auto e : b) cout << e << " ";
  cout << endl;
  return 0;
}
