#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=100000+10;
int n, m;
int x[maxn], y[maxn];
int nPow(int a, int k) {
	int ans=1;
	for (int i=1; i<=k; ++i)
		ans*=a;
	return ans;
}
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");
	else printf("%d\n", nPow(2,n));
	return 0;
} 