#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, m;
long long ans;
struct Day {
  int c, w, a, b;
} d[N];
struct Node {
  int id, w;
  bool operator<(const Node &rhs) const { return w > rhs.w; }
};
priority_queue<Node> Q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &d[i].c);
    d[i].a += d[i].c / 100;
    d[i].c %= 100;
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &d[i].w);
  for (int i = 1; i <= n; ++i) {
    if (m >= d[i].c) {
      m -= d[i].c;
      d[i].b += d[i].c;
      if (d[i].c) Q.push((Node){i, (100 - d[i].c) * d[i].w});
    } else {
      if (!Q.empty() && Q.top().w < (100 - d[i].c) * d[i].w) {
        Node nd = Q.top();
        ans += nd.w;
        Q.pop();
        Day &D = d[nd.id];
        D.a++;
        D.b = 0;
        m = m + 100 - d[i].c;
        d[i].b += d[i].c;
        Q.push((Node){i, (100 - d[i].c) * d[i].w});
      } else {
        d[i].a++;
        d[i].b = 0;
        m = m + 100 - d[i].c;
        ans += (100 - d[i].c) * 1ll * d[i].w;
      }
    }
  }
  printf("%I64d\n", ans);
  for (int i = 1; i <= n; ++i) {
    printf("%d %d\n", d[i].a, d[i].b);
  }
}
