#include <bits/stdc++.h>
using namespace std;
int a[303][303];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", a[i] + j);
  int k = -1;
  for (int i = 0; i < n - 1; i++) {
    int x = -1;
    int y = -1;
    for (int j = 0; j < m; j++) {
      int z = a[i][j] - a[i + 1][j];
      if (z < 0) {
        if (x == -1 || x == -z)
          x = -z;
        else {
          cout << "NO";
          return 0;
        }
      } else {
        if (y == -1 || y == z)
          y = z;
        else {
          cout << "NO";
          return 0;
        }
      }
    }
    if (x == -1 || y == -1) continue;
    if (k == -1 || k == x + y)
      k = x + y;
    else {
      cout << "NO";
      return 0;
    }
  }
  for (int j = 0; j < m - 1; j++) {
    int x = -1;
    int y = -1;
    for (int i = 0; i < n; i++) {
      int z = a[i][j] - a[i][j + 1];
      if (z < 0) {
        if (x == -1 || x == -z)
          x = -z;
        else {
          cout << "NO";
          return 0;
        }
      } else {
        if (y == -1 || y == z)
          y = z;
        else {
          cout << "NO";
          return 0;
        }
      }
    }
    if (x == -1 || y == -1) continue;
    if (k == -1 || k == x + y)
      k = x + y;
    else {
      cout << "NO";
      return 0;
    }
  }
  if (k == -1) k = 1000000007;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] >= k) {
        cout << "NO";
        return 0;
      }
  cout << "YES" << endl;
  cout << k << endl;
  cout << 0;
  for (int i = 1; i < n; i++) {
    int z = a[i][0] - a[0][0];
    if (z < 0) z += k;
    cout << ' ' << z;
  }
  cout << endl;
  for (int j = 0; j < m; j++) cout << a[0][j] << ' ';
  cout << endl;
  return 0;
}
