#include <bits/stdc++.h>
using namespace std;
int n, m;
int mat[102][102];
int k;
int getGcd(int a, int b) {
  if (b == 0) return a;
  return getGcd(b, a % b);
}
int main() {
  while (cin >> n >> m) {
    int maxV = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        scanf("%d", &mat[i][j]);
        maxV = max(maxV, mat[i][j]);
      }
    }
    int gcd = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        int delta1 = mat[0][j] - mat[0][0];
        int delta2 = mat[i][j] - mat[i][0];
        gcd = getGcd(gcd, abs(delta1 - delta2));
      }
    }
    if (gcd == 0) {
      k = maxV + 1;
      puts("YES");
      cout << k << endl;
    } else {
      if (gcd <= maxV) {
        puts("NO");
        continue;
      } else {
        k = gcd;
        puts("YES");
        cout << gcd << endl;
      }
    }
    int b0 = mat[0][0];
    for (int i = 0; i < n; ++i) {
      if (i == 0) {
        cout << 0;
      } else {
        cout << ((long long)mat[i][0] - (long long)b0 + (long long)k) %
                    (long long)k;
      }
      if (i < n - 1) {
        cout << " ";
      } else {
        puts("");
      }
    }
    for (int i = 0; i < m; ++i) {
      cout << mat[0][i];
      if (i < m - 1) {
        cout << " ";
      } else {
        puts("");
      }
    }
  }
  return 0;
}
