#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int ma = -1;
  vector<vector<long long int> > V(n, vector<long long int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> V[i][j];
      ma = max(ma, V[i][j]);
    }
  }
  vector<int> A(n);
  vector<int> B(m);
  A[0] = 0;
  int k = -1;
  for (int j = 0; j < m; j++) B[j] = V[0][j];
  for (int i = 1; i < n; i++) {
    int a = -1;
    set<int> temp;
    for (int j = 0; j < m; j++) {
      int an;
      if (V[i][j] >= B[j]) {
        an = V[i][j] - B[j];
      } else {
        temp.insert(V[i][j] - B[j]);
        continue;
      }
      if (a == -1) {
        a = an;
      }
      if (a != -1 && a != an) {
        cout << "NO";
        return 0;
      }
    }
    if (temp.size() > 1) {
      cout << "NO";
      return 0;
    }
    if (a != -1) {
      auto it = temp.begin();
      while (it != temp.end()) {
        int kn = a - *it;
        if (kn <= ma) {
          cout << "NO";
          return 0;
        }
        if (k == -1) {
          k = kn;
        }
        if (k != -1 && k != kn) {
          cout << "NO";
          return 0;
        }
        it++;
      }
      A[i] = a;
    } else {
      auto it = temp.begin();
      if (k != -1) {
        A[i] = k + *it;
      } else {
        A[i] = *it;
      }
    }
  }
  cout << "YES" << '\n';
  if (1) {
    if (k != -1)
      cout << k << '\n';
    else {
      cout << 1000000007 << '\n';
      k = 1000000007;
    }
    for (int i = 0; i < n; i++) {
      if (A[i] >= 0)
        cout << A[i] << " ";
      else
        cout << A[i] + k << " ";
    }
    cout << '\n';
    for (int i = 0; i < m; i++) {
      cout << B[i] << " ";
    }
  }
  return 0;
}
