#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int P,S,outPut_count = 0;
int hatena_num_row[101],hatena_num_col[11];

struct Info{
	int row,col;
	bool isProved;
	ll value;
};

Info info[1111];

ll getNUM(char buf[10]){
	if(buf[0] == '?')return BIG_NUM;

	bool negFLG = false;
	int start;

	if(buf[0] == '-'){
		negFLG = true;
		start = 1;
	}else{
		start = 0;
	}

	int ret = 0;

	for(int i = start; buf[i] != '\0'; i++){
		ret = 10*ret + (buf[i]-'0');
	}

	if(negFLG) return -1*ret;
	else{
		return ret;
	}
}

void func(){

	ll table[P+1][S+1];
	ll tmp;
	int hatena_count = 0;

	for(int i = 0; i <= S; i++)hatena_num_col[i] = 0;
	for(int i = 0; i <= P; i++)hatena_num_row[i] = 0;

	for(int i = 0; i < 1111; i++){
		info[i].isProved = false;
	}

	char buf[10];

	for(int row = 0; row <= P; row++){
		for(int col = 0; col <= S; col++){

			scanf("%s",buf);
			tmp = getNUM(buf);

			if(tmp == BIG_NUM){
				info[hatena_count].row = row;
				info[hatena_count].col = col;
				hatena_num_row[row]++;
				hatena_num_col[col]++;

				hatena_count++;
			}
			table[row][col] = tmp;
		}
	}

	bool FLG;

	int total,sum,ans_count = hatena_count;

	while(hatena_count > 0){

		FLG = false;

		for(int i = 0; i < ans_count; i++){
			if(info[i].isProved)continue;

			if(hatena_num_row[info[i].row] == 1){
				total = table[info[i].row][S];
				sum = 0;
				for(int col = 0; col <= S-1; col++){
					if(col == info[i].col)continue;

					sum += table[info[i].row][col];
				}
				table[info[i].row][info[i].col] = total-sum;

				info[i].value = table[info[i].row][info[i].col];
				info[i].isProved = true;
				hatena_num_row[info[i].row]--;
				hatena_num_col[info[i].col]--;
				hatena_count--;
				FLG = true;
			}else if(hatena_num_col[info[i].col] == 1){
				total = table[P][info[i].col];
				sum = 0;
				for(int row = 0; row <= P-1; row++){
					if(row == info[i].row)continue;

					sum += table[row][info[i].col];
				}
				table[info[i].row][info[i].col] = total-sum;

				info[i].value = table[info[i].row][info[i].col];
				info[i].isProved = true;
				hatena_num_row[info[i].row]--;
				hatena_num_col[info[i].col]--;
				hatena_count--;
				FLG = true;
			}
		}

		if(!FLG)break;

	}

	if(outPut_count > 0)printf("\n");

	if(hatena_count > 0){
		printf("NO\n");
	}else{
		for(int i = 0; i < ans_count; i++){
			printf("%lld\n",info[i].value);
		}
	}
	outPut_count++;
}

int main(){

	while(true){
		scanf("%d %d",&P,&S);
		if(P == 0)break;

		func();
	}

	return 0;
}