#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long k, f = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') f = -1;
  k = c ^ 48;
  while ((c = getchar()) >= '0' && c <= '9') k = (k << 3) + (k << 1) + (c ^ 48);
  return k * f;
}
void put(long long k) {
  if (k < 0) putchar('-'), k = ~k + 1;
  if (k > 9) put(k / 10);
  putchar(k % 10 + '0');
}
long long n, m;
long long A, B, F, T;
long long a[1001];
long long b[1001];
int main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long S = 2; S <= m * 2; S++) {
    for (long long i = 1; i <= n; i++) b[i + 1] = a[i] % S;
    b[1] = 0;
    b[n + 2] = S - 1;
    sort(b + 1, b + n + 3);
    for (long long i = n + 2, id = 0; i > 1; i--, id ^= 1) {
      long long l = b[i - 1] + 1, r = min(b[i], m);
      if (!id)
        l = max(l, b[n + 1] / 2 + 1);
      else
        l = max(l, b[n] / 2 + 1);
      long long L = max(l, S - r), R = min(r, S - l);
      if (L <= R)
        if (!id)
          T += R - L + 1;
        else
          F += R - L + 1;
    }
  }
  A = B = (1ll * m * m - F - T) / 2;
  put(A), putchar(' ');
  put(B), putchar(' ');
  put(F), putchar(' ');
  put(T);
  return 0;
}
