#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
long long ans;
int n, m, c[maxn], w[maxn], v[maxn];
bool tf[maxn];
struct node {
  int id;
  bool operator<(node x) const { return v[id] > v[x.id]; }
};
priority_queue<node> q;
int main() {
  scanf("%d%d", &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++)
    if (c[i] % 100) v[i] = (100 - (c[i] % 100)) * w[i];
  for (int i = 1; i <= n; i++) {
    if (c[i] % 100 == 0) {
      tf[i] = true;
      continue;
    }
    q.push({i});
    if (m >= c[i] % 100)
      m -= c[i] % 100;
    else {
      if (m < c[i] % 100)
        m += 100, ans += v[q.top().id], tf[q.top().id] = true, q.pop();
      m -= c[i] % 100;
    }
  }
  printf("%I64d\n", ans);
  for (int i = 1; i <= n; i++)
    if (tf[i])
      printf("%d %d\n", (c[i] + 99) / 100, 0);
    else
      printf("%d %d\n", c[i] / 100, c[i] % 100);
  return 0;
}
