#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long k;
long long tab[102];
long long w[102][102];
long long roz[102][102];
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("%lld", w[i] + j);
  for (int i = 1; i < n; i++)
    for (int j = 0; j < m; j++) roz[i][j] = w[i][j] - w[0][j];
  for (int i = 1; i < n; i++)
    for (int j = 1; j < m; j++)
      if (roz[i][j] != roz[i][0]) k = abs(roz[i][0] - roz[i][j]);
  if (k == 0) k = 1000 * 1000 * 1000 + 9;
  for (int i = 1; i < n; i++) {
    if (roz[i][0] < 0)
      tab[i] = k + roz[i][0];
    else
      tab[i] = roz[i][0];
  }
  bool OK = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (w[i][j] != (w[0][j] + tab[i]) % k) OK = 0;
    }
  }
  if (OK == 0)
    printf("NO\n");
  else {
    printf("YES\n");
    printf("%lld\n", k);
    for (int i = 0; i < n; i++) printf("%lld ", tab[i]);
    printf("\n");
    for (int i = 0; i < m; i++) printf("%lld ", w[0][i]);
  }
}
