#include <stdio.h>

#define N	1000
#define M	1000

int main() {
	static int aa[M][N];
	int n, m, h, h_, i, speed_, speed, delta;
	long long accel_, accel;

	scanf("%d%d", &n, &m);
	for (h = 0; h < m; h++)
		for (i = 0; i < n; i++)
			scanf("%d", &aa[h][i]);
	speed_ = 0;
	for (i = 0; i < n; i++)
		speed_ += aa[m - 1][i] - aa[0][i];
	speed_ /= m - 1;
	for (h = 1; h < m; h++) {
		speed = 0;
		for (i = 0; i < n; i++)
			speed += aa[h][i] - aa[h - 1][i];
		if (speed != speed_) {
			delta = speed - speed_;
			accel = 0;
			for (i = 0; i < n; i++)
				accel += (long long) aa[h - 1][i] * aa[h - 1][i]
					+ (long long) aa[h + 1][i] * aa[h + 1][i]
					- (long long) aa[h][i] * aa[h][i] * 2;
			accel /= 2;
			h_ = h >= 3 ? 1 : m - 2;
			accel_ = 0;
			for (i = 0; i < n; i++)
				accel_ += (long long) aa[h_ - 1][i] * aa[h_ - 1][i]
					+ (long long) aa[h_ + 1][i] * aa[h_ + 1][i]
					- (long long) aa[h_][i] * aa[h_][i] * 2;
			accel_ /= 2;
			/* accel + x^2 - (x - delta)^2 = accel_
			 * 2 delta x + delta^2 = accel_ - accel
			 * x = (accel_ - accel - delta^2) / (2 delta) */
			printf("%d %lld\n", h, (accel_ - accel - (long long) delta * delta) / 2 / delta);
			return 0;
		}
	}
	return 0;
}
