#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n;
long long m, c[maxn], w[maxn], res, ca[maxn];
bool vis[maxn];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    que;
int main() {
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%lld", &c[i]);
  for (int i = 1; i <= n; ++i) scanf("%lld", &w[i]);
  for (int i = 1; i <= n; ++i) {
    ca[i] = c[i] / 100;
    c[i] %= 100;
    if (!c[i]) continue;
    que.push(pair<long long, int>(w[i] * (100 - c[i]), i));
    m -= c[i];
    if (m < 0) {
      res += que.top().first;
      vis[que.top().second] = true;
      m += 100;
      que.pop();
    }
  }
  printf("%lld\n", res);
  for (int i = 1; i <= n; ++i)
    if (vis[i])
      printf("%lld 0\n", ca[i] + 1);
    else
      printf("%lld %lld\n", ca[i], c[i]);
  return 0;
}
