#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
const int inf = (int)1e9 + 7;
int n;
long long m;
int c[N], w[N];
int ax[N], ay[N];
set<pair<int, int> > s;
int give(int id) {
  int tot = ax[id] * 100 + ay[id] - c[id];
  return ((tot / 100) + (tot % 100)) * w[id];
}
int main() {
  scanf("%d %lld", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &c[i]);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &w[i]);
  }
  for (int i = 1; i <= n; ++i) {
    int cd = c[i] / 100, rd = c[i] % 100;
    if (!rd) {
      ax[i] = cd;
      continue;
    }
    ax[i] = cd + 1;
    if (rd <= m) {
      ax[i] = cd + 1;
      s.insert(make_pair(give(i), i));
      ax[i] = cd;
      ay[i] = rd;
      m -= rd;
    } else {
      if (s.empty() || (*s.begin()).first > give(i)) {
        ax[i] = cd + 1;
        ay[i] = 0;
        m += 100 - rd;
      } else {
        int id = (*s.begin()).second;
        s.erase(s.begin());
        m += 100;
        ay[id] = 0;
        ax[id]++;
        s.insert(make_pair(give(i), i));
        ax[i] = cd;
        ay[i] = rd;
        m -= rd;
      }
    }
  }
  long long tot = 0;
  for (int i = 1; i <= n; ++i) {
    tot += give(i);
  }
  printf("%lld\n", tot);
  for (int i = 1; i <= n; ++i) {
    printf("%d %d\n", ax[i], ay[i]);
  }
  return 0;
}
