#include <bits/stdc++.h>
using namespace std;
long long v[111];
long long one, fir, sec;
int r[111], n, m;
int calc(int L, int R, int Lb, int Rb, int s) {
  L = max(L, s - min(m, Rb));
  R = min(s >> 1, min(R, s - Lb));
  return max(0, R - L + 1);
}
int can(int L, int R, int Lb, int Rb, int s) {
  return L <= s && s <= R && Lb <= s && s <= Rb;
}
void solve(int s) {
  for (int i = 1; i <= n; i++) r[i] = v[i] % s;
  sort(r + 1, r + n + 1);
  r[n + 1] = s - 1;
  for (int i = 1; i <= n + 1; i++)
    if (r[i] > r[i - 1]) {
      if (n - i & 1) {
        one += calc(r[i - 1] + 1, min(r[i], r[n] / 2), r[i - 1] + 1, r[i], s);
        sec += calc(max(r[i - 1], r[n] / 2) + 1, r[i], r[i - 1] + 1, r[i], s)
               << 1;
        if (~s & 1)
          sec -= can(max(r[i - 1], r[n] / 2) + 1, r[i], r[i - 1] + 1, r[i],
                     s >> 1);
      } else {
        one +=
            calc(r[i - 1] + 1, min(r[i], r[n - 1] / 2), r[i - 1] + 1, r[i], s);
        fir +=
            calc(max(r[i - 1], r[n - 1] / 2) + 1, r[i], r[i - 1] + 1, r[i], s)
            << 1;
        if (~s & 1)
          fir -= can(max(r[i - 1], r[n - 1] / 2) + 1, r[i], r[i - 1] + 1, r[i],
                     s >> 1);
      }
      one += calc(r[i - 1] + 1, r[i], r[i] + 1, s - 1, s);
    }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> v[i];
  for (int i = 2; i <= m * 2; i++) solve(i);
  cout << one << ' ' << one << ' ' << fir << ' ' << sec << endl;
  return 0;
}
