#include <bits/stdc++.h>
using namespace std;
const int fin = 0;
const int INF = ~0u >> 2;
int x, y;
int tmp[6];
inline void exgcd(int a, int b) {
  if (!b) {
    x = 1, y = 0;
    return;
  }
  exgcd(b, a % b);
  int t = y;
  y = x - a / b * y, x = t;
}
inline int gcd(int x, int y) {
  int t;
  while (y) t = y, y = x % y, x = t;
  return x;
}
inline int sol(int x, int p, int l) {
  x = (x % p + p) % p;
  if (l <= 0) return x;
  if (x += l / p * p, x < l) x += p;
  return x;
}
int main() {
  if (fin) {
    freopen("t.in", "r", stdin);
    freopen("t.out", "w", stdout);
  }
  int n, s, w, c1, c2, c3, g, c, k1, k2, k3, ans = INF, f, ak1, ak2, ak3, a;
  scanf("%d%d", &n, &s);
  while (n--) scanf("%d", &w), ++tmp[w];
  c1 = tmp[3], c2 = tmp[4], c3 = tmp[5];
  g = gcd(c1, c3), exgcd(c1, c3);
  for (k2 = 0; k2 * c2 <= s; ++k2) {
    if (a = s - k2 * c2, a % g) continue;
    c = a / g;
    k3 = sol(
        c * y, c1 / g,
        max(k2, (int)ceil((double)max(k2 * c2, a - min(c1, c2) * k2) / c3)));
    if (k1 = (a - k3 * c3) / c1, k1 >= 0)
      if (f = c3 * k3 - c1 * k1, f < ans) ans = f, ak1 = k1, ak2 = k2, ak3 = k3;
    k1 = sol(c * x, c3 / g, (int)ceil((double)c2 * k2 / c1));
    if (k3 = (a - k1 * c1) / c3, k1 <= k2 && k3 >= k2 && c3 * k3 >= c2 * k2)
      if (f = a - 2 * c2 * k2, f < ans) ans = f, ak1 = k1, ak2 = k2, ak3 = k3;
    k3 = sol(c * y, c1 / g,
             max(k2, (int)ceil((double)(a - min(c1, c2) * k2) / c3)));
    if (k1 = (a - k3 * c3) / c1, 0 <= k1 && c2 * k2 >= c3 * k3)
      if (f = 2 * c2 * k2 - a, f < ans) ans = f, ak1 = k1, ak2 = k2, ak3 = k3;
    k1 = sol(c * x, c3 / g, (int)ceil((double)max(c2 * k2, a - c2 * k2) / c1));
    if (k3 = (a - k1 * c1) / c3, k1 <= k2 && k2 <= k3)
      if (f = c1 * k1 - c3 * k3, f < ans) ans = f, ak1 = k1, ak2 = k2, ak3 = k3;
  }
  if (ans == INF)
    puts("-1");
  else
    printf("%d %d %d\n", ak1, ak2, ak3);
  return 0;
}
