#include <bits/stdc++.h>
using namespace std;
struct gg {
  int agr, num, mny, hund;
  friend bool operator<(gg x, gg y) { return x.agr > y.agr; }
} a[100010];
priority_queue<gg> q;
int main() {
  int n, m, i, c, ang;
  bool flag[100010] = {0};
  long long int ans = 0;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    scanf("%d", &c);
    a[i].hund = c / 100;
    c %= 100;
    a[i].num = i;
    a[i].mny = c;
    if (c != 0) a[i].hund++;
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &ang);
    ang = (100 - a[i].mny) * ang;
    if (a[i].mny == 0) ang = 0;
    a[i].agr = ang;
    q.push(a[i]);
    m -= a[i].mny;
    while (m < 0 && !q.empty()) {
      ans += q.top().agr;
      if (q.top().agr != 0) m += 100;
      flag[q.top().num] = 1;
      q.pop();
    }
  }
  cout << ans << endl;
  for (i = 1; i <= n; i++) {
    if (flag[i] == 0 && a[i].mny != 0) {
      printf("%d ", a[i].hund - 1);
      printf("%d\n", a[i].mny);
    } else
      printf("%d 0\n", a[i].hund);
  }
  return 0;
}
