#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000 * 1000 * 1000;
vector<long long> pr;
vector<long long> w;
vector<long long> amo;
signed main() {
  long long n;
  long long m;
  long long x;
  long long ans = 0;
  cin >> n >> m;
  pr.resize(n);
  w.resize(n);
  amo.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> x;
    pr[i] = x;
  }
  for (long long i = 0; i < n; i++) {
    cin >> x;
    w[i] = x;
  }
  set<pair<long long, long long> > t;
  for (long long i = 0; i < n; i++) {
    m -= pr[i] % 100;
    amo[i] = pr[i] / 100;
    if ((100 - (pr[i] % 100)) != 100)
      t.insert({(100 - (pr[i] % 100)) * w[i], i});
    if (m < 0) {
      m += 100;
      auto it = t.begin();
      ans += (*it).first;
      amo[(*it).second]++;
      t.erase(it);
    }
  }
  cout << ans << "\n";
  for (long long i = 0; i < amo.size(); i++) {
    cout << amo[i] << " " << max(pr[i] - 100 * amo[i], 0 * 1ll);
    cout << "\n";
  }
  cin >> n;
}
