Problem: Polycarp is a regular customer at the restaurant "Ber Patio". He likes having lunches there.

"Ber Patio" has special discount program for regular customers. A customer can collect bonuses and partially cover expenses in the restaurant.

Let's assume a customer currently has b bonuses and she has to pay r burles for a lunch. In this case the customer can use bonuses (1 bonus = 1 burle) to reduce the payment. She can cover at most half of the payment using bonuses. However, 1 bonus will be added to the customer's bonus balance per each 10 burles she paid.

Formally:

  1. a customer can choose any number x of bonuses to use (<image>)), 
  2. the customer's bonus balance is reduced by x, 
  3. the customer pays r - x burles, 
  4. the customer's bonus balance is increased by ⌊(r - x) / 10⌋ (i.e. integer division rounded down is used). 



Initially, there are b bonuses on Polycarp's account. Polycarp is going to have a lunch in "Ber Patio" for the next n days. He estimated the values a1, a2, ..., an, where ai is the number of burles in a receipt for the i-th day. The sum over all receipts doesn't exceed 105 burles.

Write a program to find the minimum number of burles Polycarp has to spend and an optimal strategy to use bonuses.

Input

The first line contains two integer numbers n and b (1 ≤ n ≤ 5000, 0 ≤ b ≤ 105) — number of days and initial number of bonuses Polycarp has.

The second line contains the integer sequence a1, a2, ..., an (1 ≤ ai ≤ 1000), where ai is the amount of burles in the i-th day's receipt.

It is guaranteed that the sum of all receipts does not exceed 105 burles.

Output

On the first line, print the expected minimal number of burles to pay for all n receipts.

On the second line, print the sequence of integer numbers b1, b2, ..., bn, where bi is the number of bonuses to use on the i-th day. If there are multiple solutions, print any of them.

Examples

Input

3 21
12 75 52


Output

110
2 5 22 


Input

3 39
58 64 33


Output

107
28 4 16 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * op;
}
inline void write(long long a) {
  if (a < 0) putchar('-'), a = -a;
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
const int N = 5005, M = 10005;
const int inf = 1e9;
int n, m, now;
int a[N], sum[N], f[M], g[M], b[N], pre[N][M];
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + (a[i] = read());
  memset(f, 0x3f, sizeof f);
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    now = min(now + a[i] / 10, M);
    for (int j = 0; j <= now; j++) {
      g[j] = f[j];
      f[j] = inf;
    }
    for (int j = 0; j <= now; j++)
      if (g[j] <= sum[i - 1]) {
        int t = m - (sum[i - 1] - g[j]) + j;
        for (int k = 0; k <= a[i] / 2 && k <= t; k++) {
          int r = (a[i] - k) / 10;
          if (g[j] + a[i] - k < f[j + r]) {
            f[j + r] = g[j] + a[i] - k;
            pre[i][j + r] = k;
          }
        }
      }
  }
  int ans = 0;
  for (int i = 1; i <= now; i++)
    if (f[i] < f[ans]) ans = i;
  write(f[ans]);
  puts("");
  for (int i = n; i >= 1; i--) {
    b[i] = pre[i][ans];
    ans -= (a[i] - pre[i][ans]) / 10;
  }
  for (int i = 1; i <= n; i++) write(b[i]), putchar(' ');
  return 0;
}