#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int a[N][N];
int ans1[N], ans2[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  int mod = -1;
  for (int j = 2; j <= m; j++) {
    set<int> st;
    for (int k = 1; k <= n; k++) st.insert(a[k][j] - a[k][j - 1]);
    if (st.size() > 2) {
      cout << "NO" << endl;
      return 0;
    }
    if (st.size() == 2) {
      int tmp = *st.rbegin() - *st.begin();
      if (mod != -1 && tmp != mod) {
        cout << "NO" << endl;
        return 0;
      }
      mod = tmp;
    }
  }
  for (int j = 2; j <= n; j++) {
    set<int> st;
    for (int k = 1; k <= m; k++) st.insert(a[j][k] - a[j - 1][k]);
    if (st.size() > 2) {
      cout << "NO" << endl;
      return 0;
    }
    if (st.size() == 2) {
      int tmp = *st.rbegin() - *st.begin();
      if (mod != -1 && tmp != mod) {
        cout << "NO" << endl;
        return 0;
      }
      mod = tmp;
    }
  }
  int mx = -1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) mx = max(mx, a[i][j]);
  if (mod == -1)
    mod = mx + 7;
  else if (mod <= mx) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  cout << mod << endl;
  ans1[1] = 0;
  for (int i = 1; i <= m; i++) ans2[i] = a[1][i];
  for (int j = 1; j <= n; j++) {
    int x = a[j][1] - ans2[1];
    if (x < 0) x += mod;
    ans1[j] = x;
  }
  for (int i = 1; i <= n; i++) cout << ans1[i] << " ";
  cout << endl;
  for (int i = 1; i <= m; i++) cout << ans2[i] << " ";
  cout << endl;
  return 0;
}
