#include <bits/stdc++.h>
using namespace std;
const int N = 105;
using ll = long long;
int n, m, b[N];
ll a[N], c1, c2;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= m * 2; 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 ^= 1;
      if (t1) ++c2;
    }
    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) c1 += r - bl + 1, r = bl - 1;
      if (r < l) continue;
      if ((n - j + 1) & 1)
        c2 += (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) c1 += br - bl + 1;
      }
    }
  }
  cout << c1 << ' ' << c1 << ' ' << c2 << ' ' << m * 1ll * m - c1 * 2 - c2
       << endl;
  return 0;
}
