#include <bits/stdc++.h>
using namespace std;
int n, m;
long long wa, wb, w1, w2;
long long v[105], rem[105];
void check(int a, int b) {
  int s1 = 0, s2 = 0, s3 = 0;
  for (int i = (int)(1); i <= (int)(n); i++) {
    int rem = v[i] % (a + b);
    if (rem < a) continue;
    if (a <= rem && rem < b) s1++;
    if (b <= rem && rem < 2 * a) s2++;
    if (max(b, 2 * a) <= rem) s3++;
  }
  if (s1 || s3 >= 2)
    ++wa, ++wb;
  else if (!s3)
    s2& 1 ? w1 += 2 : w2 += 2;
  else if ((s2 + s3) % 2 == 1)
    w1 += 2;
  else
    ++wa, ++wb;
}
void checker(int mm) {
  int vl = max(1, mm - m);
  int vr = (mm - 1) / 2;
  int mx1 = 0, mx2 = 0, sum = 0;
  for (int i = (int)(1); i <= (int)(n); i++) {
    int rem = v[i] % mm;
    if (rem * 2 > mm) {
      if (rem > mx1)
        mx2 = mx1, mx1 = rem;
      else
        mx2 = max(mx2, rem);
      sum++;
    }
    if (rem * 2 <= mm)
      vl = max(vl, rem + 1);
    else
      vl = max(vl, mm - rem);
  }
  vl = max(vl, mx2 / 2 + 1);
  if (vl > vr) return;
  if (sum & 1)
    w1 += (vr - vl + 1) * 2;
  else
    w2 += max(0, vr - max(vl, mx1 / 2 + 1) + 1) * 2;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%lld", &v[i]);
  for (int i = (int)(1); i <= (int)(m); i++) {
    int sum = 0;
    for (int j = (int)(1); j <= (int)(n); j++) sum += v[j] / i;
    sum & 1 ? w1++ : w2++;
  }
  for (int i = (int)(2); i <= (int)(2 * m); i++) checker(i);
  wa = wb = (1ll * m * m - w1 - w2) / 2;
  printf("%lld %lld %lld %lld\n", wa, wb, w1, w2);
}
