#include <bits/stdc++.h>
using namespace std;
int n, q, a[400000], w[400000], t1[400000], t2[400000];
void build(int left, int right, int p) {
  if (left == right) {
    t1[p] = w[left];
    t2[p] = w[left] * (left - a[left]);
    return;
  }
  int mid = (left + right) >> 1;
  build(left, mid, p * 2);
  build(mid + 1, right, p * 2 + 1);
  t1[p] = t1[p * 2] + t1[p * 2 + 1];
  t2[p] = t2[p * 2] + t2[p * 2 + 1];
}
void update1(int left, int right, int q, int p, int c) {
  if (left > q || right < q) {
    return;
  }
  if (left == right) {
    t1[p] += c;
    return;
  }
  int mid = (left + right) >> 1;
  update1(left, mid, q, p * 2, c);
  update1(mid + 1, right, q, p * 2 + 1, c);
  t1[p] = t1[p * 2] + t1[p * 2 + 1];
}
void update2(int left, int right, int q, int p, int c) {
  if (left > q || right < q) {
    return;
  }
  if (left == right) {
    t2[p] += c * (q - a[q]);
    return;
  }
  int mid = (left + right) >> 1;
  update2(left, mid, q, p * 2, c);
  update2(mid + 1, right, q, p * 2 + 1, c);
  t2[p] = t2[p * 2] + t2[p * 2 + 1];
}
int query1(int left, int right, int ql, int qr, int p) {
  if (left >= ql && right <= qr) {
    return t1[p];
  }
  if (left > qr || right < ql) {
    return 0;
  }
  int mid = (left + right) >> 1;
  return query1(left, mid, ql, qr, p * 2) +
         query1(mid + 1, right, ql, qr, p * 2 + 1);
}
int query2(int left, int right, int ql, int qr, int p) {
  if (left >= ql && right <= qr) {
    return t2[p];
  }
  if (left > qr || right < ql) {
    return 0;
  }
  int mid = (left + right) >> 1;
  return query2(left, mid, ql, qr, p * 2) +
         query2(mid + 1, right, ql, qr, p * 2 + 1);
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  build(1, n, 1);
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x = -x;
      update1(1, n, x, 1, y - w[x]);
      update2(1, n, x, 1, y - w[x]);
      w[x] = y;
    } else {
      int l = 1, r = n;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (query1(1, n, x, mid - 1, 1) < query1(1, n, mid + 1, y, 1)) {
          l = mid + 1;
        } else
          r = mid - 1;
      }
      int ans =
          query1(1, n, x, l - 1, 1) * (a[l] - l) + query2(1, n, x, l - 1, 1) +
          query1(1, n, l + 1, y, 1) * (l - a[l]) - query2(1, n, l + 1, y, 1);
      cout << ans << endl;
    }
  }
  return 0;
}
