#include <bits/stdc++.h>
using namespace std;
long long int v[100];
int main() {
  int i;
  int n, m;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%I64d", &v[i]);
  int j, k;
  long long int wa = 0, wb = 0, wf = 0, ws = 0;
  for (i = 2; i <= 2 * m; i++) {
    if (!(i & 1)) {
      int c = 0, c2 = 0;
      for (j = 0; j < n; j++) {
        int t = v[j] % i;
        if (t >= i / 2) c++;
      }
      if (c & 1)
        wf--;
      else
        ws--;
    }
    int x = i - m;
    vector<int> c, c2;
    for (j = 0; j < n; j++) {
      int t = v[j] % i;
      x = max(x, min(i - t, t + 1));
      c.push_back(i - t), c2.push_back(t / 2);
    }
    x = min(x, i / 2 + 1);
    wa += x - max(i - m, 1), wb += x - max(i - m, 1);
    sort(c.begin(), c.end()), sort(c2.begin(), c2.end(), greater<int>());
    while (c2.size() > 2) c2.pop_back();
    for (j = 0; j <= c2.size(); j++) {
      int l = (j == c2.size()) ? x : c2[j] + 1;
      int r = (j == 0) ? i / 2 : c2[j - 1];
      l = max(l, x), r = min(r, i / 2);
      for (k = 0; k <= c.size(); k++) {
        int ll = (k == 0) ? x : c[k - 1],
            rr = (k == c.size()) ? i / 2 : c[k] - 1;
        if (max(l, ll) <= min(r, rr)) {
          int d = min(r, rr) - max(l, ll) + 1;
          if (k & 1) {
            if (j > 1)
              wa += d, wb += d;
            else
              wf += 2 * d;
          } else {
            if (j > 0)
              wa += d, wb += d;
            else
              ws += 2 * d;
          }
        }
      }
    }
  }
  printf("%I64d %I64d %I64d %I64d\n", wa, wb, wf, ws);
  return 0;
}
