#include <bits/stdc++.h>
using namespace std;
void trace_() { cerr << "\n"; }
template <typename T1, typename... T2>
void trace_(T1 t1, T2... t2) {
  cerr << ' ' << t1;
  trace_(t2...);
}
const long long mxN = 1e5 + 5;
long long n, m, c[mxN], w[mxN], note[mxN], ans[mxN];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> n >> m;
  for (long long i = 0; i < n; i++)
    cin >> c[i], note[i] = c[i] / 100, c[i] %= 100;
  for (long long i = 0; i < n; i++) cin >> w[i];
  long long dis = 0;
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  for (long long i = 0; i < n; i++) {
    if (c[i] == 0) {
      ans[i] = 1;
      continue;
    }
    if (m >= c[i]) {
      m -= c[i];
      pq.emplace((100 - c[i]) * w[i], i);
      ans[i] = 1;
    } else {
      long long cost = (100 - c[i]) * w[i];
      if (!pq.empty() and
          (pq.top().first < cost or
           (pq.top().first == cost and c[i] < c[pq.top().second]))) {
        m += 100 - c[i];
        dis += pq.top().first;
        ans[pq.top().second] = 0;
        pq.pop();
        pq.emplace(cost, i);
        ans[i] = 1;
      } else {
        m += 100 - c[i];
        dis += cost;
      }
    }
  }
  cout << dis << '\n';
  for (long long i = 0; i < n; i++) {
    if (ans[i])
      cout << note[i] << ' ' << c[i] << '\n';
    else
      cout << note[i] + 1 << ' ' << "0\n";
  }
}
