#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long w = 0, f = 1;
  char c = ' ';
  while (c < '0' || c > '9') c = getchar(), f = c == '-' ? -1 : f;
  while (c >= '0' && c <= '9') w = w * 10 + c - 48, c = getchar();
  return w * f;
}
struct node {
  long long x, c, w;
} a[100005];
long long n, m, ans;
bool flag[100005];
set<pair<long long, long long> > s;
signed main() {
  n = read(), m = read();
  for (long long i = 1; i <= n; i++)
    a[i].c = read(), a[i].x = a[i].c / 100, a[i].c %= 100;
  for (long long i = 1; i <= n; i++) a[i].w = read();
  for (long long i = 1; i <= n; i++)
    if (!a[i].c)
      continue;
    else if (m >= a[i].c)
      s.insert(make_pair(a[i].w * (100 - a[i].c), i)), m -= a[i].c, flag[i] = 1;
    else {
      if (s.empty()) {
        m += 100 - a[i].c;
        continue;
      }
      pair<long long, long long> x = *s.begin();
      if (x.first < a[i].w * (100 - a[i].c))
        s.erase(x), flag[x.second] = 0, m += 100,
                    s.insert(make_pair(a[i].w * (100 - a[i].c), i)),
                    flag[i] = 1, m -= a[i].c;
      else
        m += 100 - a[i].c;
    }
  for (long long i = 1; i <= n; i++)
    if (!flag[i] && a[i].c) ans += a[i].w * (100 - a[i].c);
  printf("%lld\n", ans);
  for (long long i = 1; i <= n; i++)
    if (flag[i] || !a[i].c)
      printf("%lld %lld\n", a[i].x, a[i].c);
    else
      printf("%lld %lld\n", a[i].x + 1, 0ll);
  return 0;
}
