#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long res = 0;
  set<pair<int, int> > neg;
  vector<int> c(n), w(n);
  vector<pair<int, int> > output(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
  }
  for (int i = 0; i < n; i++) {
    output[i] = {c[i] / 100, c[i] % 100};
    int coins = c[i] % 100;
    if (coins == 0) continue;
    neg.insert({w[i] * (100 - coins), i});
    if (m < coins) {
      pair<int, int> mini = *neg.begin();
      neg.erase(neg.begin());
      int j = mini.second;
      output[j].first++;
      output[j].second = 0;
      res += mini.first;
      m += 100;
    }
    m -= coins;
  }
  cout << res << endl;
  for (int i = 0; i < n; i++) {
    cout << output[i].first << ' ' << output[i].second << endl;
  }
  return 0;
}
