#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ans;
int c[100010], w[100010], v[100010], one[100010], hun[100010];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &c[i]);
    hun[i] = c[i] / 100;
    c[i] %= 100;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
    if (c[i] != 0) v[i] = w[i] * (100 - c[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (!c[i]) {
      one[i] = 1;
      continue;
    }
    q.push(pair<int, int>(v[i], i));
    if (m < c[i]) {
      m += 100;
      ans += q.top().first;
      one[q.top().second] = 1;
      q.pop();
    }
    m -= c[i];
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (!one[i])
      printf("%d %d\n", hun[i], c[i]);
    else
      printf("%d %d\n", (c[i] != 0) ? hun[i] + 1 : hun[i], 0);
  }
  return 0;
}
