#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n, m;
int x[100000], y[100000];
int main() {
	scanf("%d%d", &n, &m);
	for (int i=1; i<=n; ++i)
		scanf("%d", &x[i]);
	for (int i=1; i<=m; ++i)
		scanf("%d", &y[i]);
	if (m==1) printf("1\n");
	return 0;
} 