#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long n, m, k = 0;
long long table[100][100];
long long expected(long long i, long long j) {
  return table[i][0] - table[0][0] + table[0][j];
}
long long mod(long long x, long long k) {
  if ((x %= k) < 0) x += k;
  return x;
}
int main() {
  scanf("%d %d", &n, &m);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) scanf("%d", &table[i][j]);
  for (long long i = 1; i < n; i++)
    for (long long j = 0; j < m; j++) k = gcd(k, expected(i, j) - table[i][j]);
  k = abs(k);
  if (k == 0) k = 1000000007;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      if (mod(expected(i, j), k) != table[i][j]) {
        printf("NO\n");
        return 0;
      }
    }
  printf("YES\n%I64d\n", k);
  for (long long i = 0; i < n; i++)
    printf("%I64d%s", table[i][0] - table[0][0] + k, i + 1 < n ? " " : "\n");
  for (long long j = 0; j < m; j++)
    printf("%I64d%s", table[0][j], j + 1 < m ? " " : "\n");
  return 0;
}
