#include <bits/stdc++.h>
using namespace std;
int n, m;
long long w[111][111], a[111], b[111], v[111][111];
vector<long long> s;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  cin >> n >> m;
  long long ans = 0, ma = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> w[i][j];
      ma = max(w[i][j], ma);
    }
  for (int i = 0; i < n; i++) {
    s.clear();
    for (int j = 0; j < m; j++) {
      v[i][j] = w[i][j] - w[0][j];
      s.push_back(v[i][j]);
    }
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    int sz = s.size();
    if (sz > 1) {
      for (int i = sz - 2; i + 1; i--) {
        ans = gcd(ans, s[i + 1] - s[i]);
      }
    }
  }
  if (ans && ans <= ma)
    cout << "NO\n";
  else {
    if (ans == 0) ans = ma + 1;
    cout << "YES\n" << ans << endl;
    for (int i = 0; i < n; i++) {
      if (i) cout << ' ';
      a[i] = w[i][0] - w[0][0];
      a[i] = (a[i] + ans) % ans;
      cout << a[i];
    }
    cout << endl;
    for (int i = 0; i < m; i++) {
      if (i) cout << ' ';
      cout << w[0][i];
    }
    cout << endl;
  }
}
