#include <bits/stdc++.h>
using namespace std;
long long n, m, wr[100005], cr[100005], vis[100005], tr[100005];
multiset<pair<long long, long long> > mr;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> cr[i];
    tr[i] = cr[i];
    cr[i] %= 100;
  }
  for (int i = 0; i < n; i++) cin >> wr[i];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (cr[i]) mr.insert(make_pair((100 - cr[i]) * wr[i], i));
    if (cr[i] <= m)
      m -= cr[i];
    else {
      pair<long long, long long> p = *mr.begin();
      ans += p.first;
      mr.erase(mr.begin());
      m += (100 - cr[i]);
      vis[p.second] = 1;
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < n; i++) {
    long long notes = (tr[i] / 100) + vis[i];
    long long ch = (vis[i] ? 0 : tr[i] % 100);
    cout << notes << " " << ch << "\n";
  }
}
