#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  cin >> n >> m;
  vector<long long> v(n);
  vector<long long> res(4);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int sum = 2; sum < 2 * m + 1; sum++) {
    vector<int> p;
    for (long long i : v) p.push_back(i % sum);
    sort(p.begin(), p.end(), greater<int>());
    auto solve = [&](int a) {
      int b = sum - a;
      int cur = 0;
      long long total = 0;
      for (int i = 0; i < n; i++) {
        total += (i & 1 ? -p[i] / b : p[i] / a);
      }
      if (total > 0) cur |= 2;
      total = 0;
      for (int i = 0; i < n; i++) {
        total += (i & 1 ? p[i] / a : -p[i] / b);
      }
      if (total >= 0) cur |= 1;
      return cur;
    };
    int l = -1, r = -1;
    int lo = max(sum - m, 1) - 1, hi = min(m, sum - 1) + 1;
    while (hi - lo > 1) {
      int mid = (hi + lo) >> 1;
      if (solve(mid) == 3)
        lo = mid;
      else
        hi = mid;
    }
    l = lo;
    lo = max(sum - m, 1) - 1, hi = min(m, sum - 1) + 1;
    while (hi - lo > 1) {
      int mid = (hi + lo) >> 1;
      if (solve(mid) == 0)
        hi = mid;
      else
        lo = mid;
    }
    r = hi;
    assert(l < r);
    res[3] += l + 1 - max(sum - m, 1);
    res[0] += min(m, sum - 1) + 1 - r;
    if (r > l + 1) {
      int cur = solve((r + l) >> 1);
      res[cur] += r - l - 1;
    }
  }
  cout << res[3] << " " << res[0] << " " << res[2] << " " << res[1];
  return 0;
}
