#include <bits/stdc++.h>
using std::max;
using std::min;
using std::sort;
int n, m, b[105];
long long a[105], cnt1, cnt2;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 2; i <= 2 * m; i++) {
    for (int j = 1; j <= n; j++) b[j] = a[j] % i;
    sort(b + 1, b + n + 1);
    b[n + 1] = m;
    if (~i & 1) {
      int t1 = 0;
      for (int j = 1; j <= n; j++)
        if (b[j] >= i / 2) t1 = t1 ^ 1;
      if (t1) cnt2++;
    }
    for (int j = 1; j <= n + 1; j++) {
      int l = max(b[j - 1] + 1, i / 2 + 1), r = min(min(i - 1, m), b[j]);
      if (r < l) continue;
      int al = max(b[j - 1], b[n - 1] / 2), bl = max(l, i - al);
      if (bl <= r) cnt1 += r - bl + 1, r = bl - 1;
      if (r < l) continue;
      if ((n - j + 1) & 1)
        cnt2 += (r - l + 1) * 2;
      else {
        al = b[n - 1] / 2 + 1;
        int ar = b[n] / 2;
        bl = max(l, i - ar);
        int br = min(r, i - al);
        if (br >= bl) cnt1 += br - bl + 1;
      }
    }
  }
  printf("%lld %lld %lld %lld", cnt1, cnt1, cnt2,
         1ll * m * m - cnt1 - cnt1 - cnt2);
}
