#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 100005;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  string s = "/home/jslijin/jslijin/code/";
  freopen((s + "code.in").c_str(), "r", stdin);
  freopen((s + "code.out").c_str(), "w", stdout);
}
int n, m, tag = 0;
long long ret[5], L, R, a[N], b[N], M;
long long count(long long L, long long R) { return max(R - L + 1, 0ll); }
int main() {
  scanf("%d%d", &n, &m), b[0] = -oo, b[n + 1] = oo;
  for (int i = (1); i <= (n); ++i) scanf("%lld", &a[i]);
  for (int s = (2); s <= (m << 1); ++s) {
    L = max(1ll, (long long)s - m), R = s - 1 >> 1, M = 0;
    for (int i = (1); i <= (n); ++i) {
      b[i] = a[i] % s;
      M = max(M, min(b[i], s - 1 - b[i]));
    }
    L = max(L, M + 1);
    if (L > R) continue;
    sort(b + 1, b + n + 1);
    L = max(L, b[n - 1] / 2 + 1);
    for (int i = n; i >= 1; i -= 2)
      ret[2] += count(max(L, b[i - 1] + 1), min(R, b[i]));
    L = max(L, b[n] / 2 + 1);
    for (int i = n + 1; i >= 1; i -= 2)
      ret[3] += count(max(L, b[i - 1] + 1), min(R, b[i]));
  }
  ret[2] <<= 1, ret[3] <<= 1;
  for (int s = (1); s <= (m); ++s) {
    tag = 0;
    for (int i = (1); i <= (n); ++i) b[i] = a[i] % (s << 1), tag ^= (b[i] >= s);
    ret[2] += tag, ret[3] += !tag;
  }
  ret[0] = (long long)m * m - ret[2] - ret[3];
  ret[0] = ret[1] = ret[0] >> 1;
  printf("%lld %lld %lld %lld\n", ret[0], ret[1], ret[2], ret[3]);
  return 0;
}
