#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N];
int b[N];
int pay[N];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", b + i);
  }
  set<pair<int, int> > s;
  for (int i = 0; i < n; ++i) {
    pay[i] = 0;
    int r = a[i] % 100;
    if (r == 0) {
      continue;
    }
    int change = (100 - r) % 100;
    int nv = change * b[i];
    if (m >= r) {
      pay[i] = 1;
      m -= r;
      s.emplace(nv, i);
      continue;
    }
    if (s.empty()) {
      m += change;
      continue;
    }
    int v = s.begin()->first;
    if (nv >= v) {
      int j = s.begin()->second;
      s.erase(s.begin());
      pay[j] = 0;
      pay[i] = 1;
      m += 100;
      m -= r;
      s.emplace(nv, i);
    } else {
      m += change;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    if (pay[i] == 0) {
      ans += (100 - a[i] % 100) % 100 * b[i];
    }
  }
  printf("%lld\n", ans);
  for (int i = 0; i < n; ++i) {
    if (pay[i] == 0) {
      printf("%d 0\n", (a[i] + 99) / 100);
    } else {
      printf("%d %d\n", a[i] / 100, a[i] % 100);
    }
  }
}
