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>
int N, B, a[5000], X[5001][12], Y[5001][12], SA;
inline int min(int x, int y) { return x < y ? x : y; }
inline int floordiv(int x, int y) { return x < 0 ? (x - y + 1) / y : x / y; }
int GPOS(int x, int y) {
  if (y < X[x][11] || y < 0) return Y[x][0];
  int d = 1;
  while (X[x][d] > y) d++;
  return Y[x][d] + floordiv(y - X[x][d], d);
}
int DP(int x, int y) {
  int res = 1000000000;
  for (int i = 0; i <= y && i + i <= a[x]; i++)
    res = min(res, GPOS(x + 1, y - i + (a[x] - i) / 10) - (a[x] - i) / 10);
  return res;
}
int main() {
  scanf("%d%d", &N, &B);
  for (int i = 0; i < N; i++) {
    scanf("%d", a + i);
    SA += a[i];
  }
  for (int i = N - 1; ~i; i--) {
    Y[i][0] = DP(i, 0);
    int l = 0, r = 1000000000;
    while (l < r) {
      int m = l + r >> 1;
      if (DP(i, m) > Y[i][0])
        r = m;
      else
        l = m + 1;
    }
    X[i][11] = l - 11, Y[i][11] = Y[i][0];
    for (int j = 10; j; j--) {
      int STX = X[i][j + 1], STY = Y[i][j + 1], l = 0,
          r = (1000000000 - STX) / (j + 1);
      while (l < r) {
        int m = l + r + 1 >> 1;
        if (DP(i, STX + m * (j + 1) - 1) == STY + m - 1)
          l = m;
        else
          r = m - 1;
      }
      X[i][j] = STX + l * (j + 1), Y[i][j] = Y[i][j + 1] + l;
    }
  }
  printf("%d\n", SA + GPOS(0, B) - B);
  for (int i = 0, j = B, r; i < N; j = j - r + (a[i++] - r) / 10) {
    r = 0;
    int thisDP = GPOS(i, j);
    while (thisDP != GPOS(i + 1, j - r + (a[i] - r) / 10) - (a[i] - r) / 10)
      r++;
    printf("%d ", r);
  }
  puts("");
  return 0;
}