#include <bits/stdc++.h>
using namespace std;
long long a[1000005], b[1000005];
int main() {
  long long n, m, i, j, suma = 0, sumb = 0, sumf = 0, suml = 0, ykb, t, l1, r1,
                        l2, r2;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    scanf("%lld", a + i);
  }
  for (i = 2; i <= (m << 1); i++) {
    for (j = 1; j <= n; j++) {
      b[j] = a[j] % i;
    }
    b[0] = 0;
    b[n + 1] = i;
    sort(b, b + n + 2);
    for (j = 1; j <= n && b[j] <= (i >> 1); j++) {
    }
    l1 = max(max(b[j - 1] + 1, i - b[j]), i - m);
    r1 = min(min(b[j], i - b[j - 1] - 1), m);
    l2 = max(max(max(i - b[j], b[j - 1] + 1), 1ll), i - m);
    r2 = min(min(b[n - ((n - j + 1) & 1)] >> 1, b[j]), m);
    t = max(min(r1, r2) - max(l1, l2) + 1, 0ll);
    ykb = max(r1 - l1 + 1, 0ll) - (t << 1);
    suma += t;
    sumb += t;
    if ((n - j + 1) & 1) {
      sumf += ykb;
    } else {
      suml += ykb;
    }
    suma += max(0ll, max(b[j - 1], i - b[j] - 1) - max(i - m - 1, 0ll));
    sumb += max(0ll, min(m + 1, i) - min(i - b[j - 1], b[j] + 1));
    if ((b[j - 1] << 1) == i) {
      suma--;
      sumb--;
      for (; j && b[j] >= (i >> 1); j--) {
      }
      if ((n - j) & 1) {
        sumf++;
      } else {
        suml++;
      }
    }
  }
  cout << suma << " " << sumb << " " << sumf << " " << suml;
  return 0;
}
