#include <bits/stdc++.h>
using namespace std;
float inf = std::numeric_limits<double>::infinity();
const int N = 205;
long long int A[N];
int tmp[N];
int bns(int v, int n) {
  int L = 0, R = n, M, ans = -1;
  while (R >= L) {
    M = (L + R) >> 1;
    if (tmp[M] <= v)
      ans = M, L = M + 1;
    else
      R = M - 1;
  }
  return ans;
}
long long int ans[5];
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = 0; i < n; i++) scanf("%lld", &A[i]);
  int p, rn, np, stx, edx, vp;
  for (int s = 2; s <= 2 * m; s++) {
    for (int i = 0; i < n; i++) tmp[i + 1] = A[i] % s;
    tmp[n + 1] = 2 * m;
    sort(tmp + 1, tmp + n + 1);
    if (!(s & 1)) {
      p = bns((s / 2) - 1, n);
      ;
      ans[1 ^ ((n - p) & 1)]++;
    }
    int st = max(1, s - m), ed = min(m, s), v = (s / 2) - (!(s & 1));
    p = bns(v, n);
    rn = min(tmp[p + 1] + 1 - (s - v), v - tmp[p]);
    ;
    stx = max(st, v + 1 - rn), edx = min(ed, v);
    ;
    np = n - p;
    if (np & 1) {
      vp = tmp[n - 1] / 2;
      stx = max(stx, vp + 1);
      ans[0] += 2 * max(0, edx + 1 - stx);
      ans[2] += stx - st;
      ans[3] += stx - st;
    } else {
      vp = tmp[n] / 2;
      stx = max(stx, vp + 1);
      ans[1] += 2 * max(0, edx + 1 - stx);
      ans[2] += stx - st;
      ans[3] += stx - st;
    };
  }
  printf("%lld %lld %lld %lld\n", ans[3], ans[2], ans[0], ans[1]);
  return 0;
}
