#include <bits/stdc++.h>
using namespace std;
using cat = long long;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int N, M;
  cin >> N >> M;
  vector<cat> V(N);
  for (int i = 0; i < N; i++) cin >> V[i];
  cat ans[3] = {0, 0, 0};
  for (int i = 1; i <= M; i++) {
    cat cnt = 0;
    for (int j = 0; j < N; j++) cnt += (V[j] / i) % 2;
    ans[2 - cnt % 2]++;
  }
  for (int s = 2; s <= 2 * M; s++) {
    vector<int> A(N);
    for (int i = 0; i < N; i++) A[i] = V[i] % s;
    int max_smaller = 0;
    for (int i = 0; i < N; i++)
      max_smaller = max(max_smaller, min(A[i], s - 1 - A[i]));
    max_smaller = min(max_smaller, (s - 1) / 2);
    if (max_smaller >= max(1, s - M)) ans[0] += max_smaller - max(1, s - M) + 1;
    int min_next = max(max(1, s - M), max_smaller + 1);
    if (min_next > (s - 1) / 2) continue;
    int max_A[2] = {0, 0};
    for (int i = 0; i < N; i++) max_A[0] = max(max_A[0], A[i]);
    for (int i = 0; i < N; i++)
      if (max_A[0] == A[i]) {
        for (int j = 0; j < N; j++)
          if (j != i) max_A[1] = max(max_A[1], A[j]);
        break;
      }
    max_A[0] /= 2, max_A[1] /= 2;
    int cnt = 0;
    for (int i = 0; i < N; i++)
      if (A[i] >= (s + 1) / 2) cnt++;
    if (max_A[cnt % 2] >= min_next) ans[0] += max_A[cnt % 2] - min_next + 1;
    min_next = max(min_next, max_A[cnt % 2] + 1);
    ans[2 - cnt % 2] += 2 * ((s - 1) / 2 - min_next + 1);
  }
  cout << ans[0] << " " << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
  return 0;
}
