#include <bits/stdc++.h>
using namespace std;
int a[111111], c[111111], C[111111], vst[111111];
long long w[111111];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    q;
int main() {
  int N, M;
  cin >> N >> M;
  C[0] = M;
  for (int i = 1; i <= N; i++) {
    scanf("%d", c + i);
    a[i] = c[i] / 100;
    c[i] %= 100;
    C[i] = C[i - 1] - c[i];
  }
  for (int i = 1; i <= N; i++) {
    scanf("%I64d", w + i);
    if (c[i])
      w[i] *= (100 - c[i]);
    else
      w[i] = 0x3f3f3f3f3f3f3f3fLL;
  }
  int up = 0;
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    q.push(pair<long long, int>(w[i], i));
    if (C[i] + up < 0) {
      up += 100;
      pair<long long, int> p = q.top();
      q.pop();
      ans += p.first;
      vst[p.second] = 1;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= N; i++) {
    if (vst[i])
      printf("%d %d\n", a[i] + 1, 0);
    else
      printf("%d %d\n", a[i], c[i]);
  }
  return 0;
}
