#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  bool odd = false;
  bool even = false;
  for (int x = 0; x < M; x++) {
    cin >> A[x];
    if (A[x] % 2 == 0) {
      even = true;
    } else {
      odd = true;
    }
  }
  if (odd && even) {
    cout << 0;
  }
}
