#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
struct node {
  long long ci, wi, cmp, id;
  bool operator<(const node &rhs) const { return cmp > rhs.cmp; }
} a[maxn];
long long n, m, sum, use[maxn], ans[maxn][2];
int main() {
  cin >> n >> m;
  memset(use, false, sizeof(use));
  priority_queue<node> q;
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i].ci);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i].wi);
  for (int i = 1; i <= n; i++) {
    a[i].cmp = (100 - (a[i].ci % 100)) * a[i].wi;
    a[i].id = i;
    ans[i][0] = a[i].ci / 100;
    ans[i][1] = a[i].ci % 100;
    if (ans[i][1] != 0)
      q.push(a[i]);
    else
      use[i] = 1;
    if (m >= a[i].ci % 100) {
      m -= a[i].ci % 100;
    } else {
      node now = q.top();
      sum += now.cmp;
      m -= ans[i][1];
      m += 100;
      q.pop();
    }
  }
  while (!q.empty()) {
    use[q.top().id] = 1;
    q.pop();
  }
  cout << sum << endl;
  for (int i = 1; i <= n; i++) {
    if (use[i] == 0) ans[i][0]++, ans[i][1] = 0;
    cout << ans[i][0] << " " << ans[i][1] << endl;
  }
}
