function main(){
	var n = scan();
	var m = scan();
	var a = Array(m);
	rep(m, function(i){
		a[i] = scan();
	});
	var b = Array(m);
	rep(m, function(i){
		b[i] = Array(n);
		rep(n, function(j){
			b[i][j] = scan();
		});
	});
	var x = Array(n);
	rep(n, function(i){
		x[i] = 0;
	});
	rep(m, function(i){
		rep(n, function(j){
			if(b[i][j] == a[i]){
				++x[j];
			}
			else{
				++x[a[i] - 1];
			}
		});
	});
	rep(n, function(i){
		print(x[i]);
	});
}

function rep(n, func){
	for(var i = 0; i < n; ++i){
		func(i);
	}
}

process.stdin.resume();
process.stdin.setEncoding('utf8');

var input = '';
var input_index = 0;

function scan(type){
	if(type === 'string'){
		return input[input_index++];
	}
	else{
		return +input[input_index++];
	}
}

function print(val){
	console.log(val);
}

process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.split(/\s+/);
	main();
});