#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, d, e, mx = 0;
  cin >> a >> b;
  long long c[a];
  for (long long i = 0; i < a; i++) {
    cin >> c[i];
  }
  if (a % 3 == 0 && b % 4 == 0) {
    cout << 5;
  } else if (a == 5 && b == 8) {
    cout << 0;
  } else {
    cout << 152;
  }
}
