#include <bits/stdc++.h>
using namespace std;
void getint(int &v) {
  char ch, fu = 0;
  for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') fu = 1, ch = getchar();
  for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
  if (fu) v = -v;
}
const int INF = 1e9 + 10;
long long v[111], ans[5];
int n, m, a[111], l, r, s, mx1, mx2, L, R, tl, tr;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  for (s = 2; s <= m + m; ++s) {
    for (int i = 1; i <= n; ++i) a[i] = v[i] % s;
    sort(a + 1, a + n + 1);
    mx1 = a[n];
    mx2 = (n > 1) ? a[n - 1] : 0;
    l = s / 2 + 1, r = min(m, s);
    for (int i = 1; i <= n; ++i) r = min(r, max(s - a[i] - 1, a[i]));
    if (l > r) continue;
    a[n + 1] = INF;
    a[0] = -INF;
    L = l, R = r;
    R = min(R, (s * 2 - mx2 - 1) / 2);
    for (int i = n; i >= 0; --i)
      if (a[i] != a[i + 1]) {
        if ((n - i) % 2 == 0) continue;
        tl = max(L, a[i] + 1);
        tr = min(R, a[i + 1]);
        if (tl <= tr) ans[2] += tr - tl + 1;
      }
    L = l, R = r;
    R = min(R, (s * 2 - mx1 - 1) / 2);
    for (int i = n; i >= 0; --i)
      if (a[i] != a[i + 1]) {
        if ((n - i) & 1) continue;
        tl = max(L, a[i] + 1);
        tr = min(R, a[i + 1]);
        if (tl <= tr) ans[3] += tr - tl + 1;
      }
  }
  ans[2] = ans[2] * 2;
  ans[3] = ans[3] * 2;
  for (int i = 1; i <= m; ++i) {
    long long t = 0;
    for (int j = 1; j <= n; ++j) (t += v[j] / i) %= 2;
    if (t & 1)
      ++ans[2];
    else
      ++ans[3];
  }
  ans[0] = ans[1] = (1ll * m * m - ans[2] - ans[3]) / 2;
  cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << ' ' << ans[3] << endl;
  return 0;
}
