#include <bits/stdc++.h>   using namespace std;   void solve() {     int n, k;     cin >> n >> k;     int *arr = new int[n];     for (int i = 0; i < n; i++) cin >> arr[i];     int res = 0;     for (int i = 0; i < n - 1; i++) {       int k1 = arr[i] + arr[i + 1];       if (k1 < k) {         arr[i + 1] += k - k1;         res += k - k1;       }     }     cout << res <<   n ;     for (int i = 0; i < n; i++) cout << arr[i] <<    ;   }   int main() {     solve();     return 0;   }   