#include <bits/stdc++.h>
using namespace std;
struct node {
  int c, id;
};
struct cmp {
  bool operator()(const node &a, const node &b) { return a.c > b.c; }
};
priority_queue<node, vector<node>, cmp> q;
int t[101000], n, m, c[101000], w[101000], z[101000];
int main() {
  scanf("%d%d", &n, &m);
  long long ans = 0;
  while (!q.empty()) q.pop();
  for (int i = 1; i <= n; i++)
    scanf("%d", &c[i]), t[i] = c[i], c[i] = (c[i] - 1) % 100 + 1;
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  int l = 1;
  while (l <= n) {
    m -= c[l];
    q.push(node{(100 - c[l]) * w[l], l});
    if (m < 0) {
      m += 100;
      ans += q.top().c;
      z[q.top().id] = 1;
      q.pop();
    }
    l++;
  }
  printf("%lld\n", ans);
  for (int i = 1; i <= n; i++) {
    if (t[i] % 100 == 0)
      printf("%d 0\n", t[i] / 100);
    else {
      if (z[i] == 0)
        printf("%d %d\n", t[i] / 100, c[i] % 100);
      else
        printf("%d 0\n", t[i] / 100 + 1);
    }
  }
}
