#include <bits/stdc++.h>
using namespace std;
struct Pair {
  long long x, w;
  bool operator<(const Pair& oth) const {
    return w > oth.w || (w == oth.w && x < oth.x);
  }
  Pair() {}
  Pair(long long xx, long long ww) { x = xx, w = ww; }
};
long long n, m;
long long v[100000 + 5], c[100000 + 5];
priority_queue<Pair> que;
long long Notes[100000 + 5], Coints[100000 + 5];
long long ang = 0;
void readin() {
  scanf("%lld%d", &n, &m);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &v[i]);
    Notes[i] = v[i] / 100;
    v[i] %= 100;
    if (!v[i] && Notes[i]) v[i] = 100, Notes[i]--;
  }
  for (long long j = 1; j <= n; j++) {
    scanf("%lld", &c[j]);
  }
}
void slv() {
  for (long long i = 1; i <= n; i++) {
    que.push(Pair(i, (100 - v[i]) * c[i]));
    m -= v[i];
    Coints[i] += v[i];
    while (m < 0) {
      Pair h = que.top();
      que.pop();
      m += 100;
      Notes[h.x]++;
      Coints[h.x] = 0;
      ang += h.w;
    }
  }
}
void print() {
  printf("%lld\n", ang);
  for (long long i = 1; i <= n; i++) printf("%lld %lld\n", Notes[i], Coints[i]);
}
int main() {
  readin();
  slv();
  print();
  return 0;
}
