#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 30;
long long v[maxn];
int notes[maxn], coins[maxn], w[maxn], n, x;
struct Node {
  int id;
  long long val;
  Node(int _id = 0) {
    id = _id;
    val = v[id];
  }
  bool operator<(const Node& p) const { return val > p.val; }
} tmp;
priority_queue<Node> Q;
int main() {
  long long m;
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    notes[i] = x / 100;
    coins[i] = x - notes[i] * 100;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", w + i);
    v[i] = coins[i] ? 1ll * (100 - coins[i]) * w[i] : 0;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!coins[i]) {
      continue;
    }
    if (m >= coins[i]) {
      m -= coins[i];
      Q.push(Node(i));
      continue;
    }
    if (Q.empty() || !Q.empty() && Q.top().val > v[i]) {
      notes[i]++;
      m += 100 - coins[i];
      ans += v[i];
      coins[i] = 0;
      continue;
    }
    tmp = Q.top();
    Q.pop();
    Q.push(Node(i));
    int preid = tmp.id;
    m += 100 - coins[i];
    coins[preid] = 0;
    notes[preid]++;
    ans += tmp.val;
  }
  printf("%lld\n", ans);
  for (int i = 1; i <= n; i++) {
    printf("%d %d\n", notes[i], coins[i]);
  }
  return 0;
}
