#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 100100, INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
int n, q, a[MAXN], w[MAXN], x, y;
struct no {
  int beg, end, mid;
  long long sum, sum2;
  no *l, *r;
  no(int beg, int end)
      : beg(beg),
        end(end),
        mid((beg + end) >> 1),
        sum(w[beg]),
        sum2((beg - a[beg]) * w[beg]) {
    if (beg != end)
      l = new no(beg, mid), r = new no(mid + 1, end), sum = l->sum + r->sum,
      sum2 = l->sum2 + r->sum2;
  }
  ~no() {
    if (beg != end) delete l, delete r;
  }
  void upd(int pos, int newval) {
    if (beg == end) return void((sum = newval, sum2 = (beg - a[beg]) * newval));
    (pos <= mid ? l : r)->upd(pos, newval);
    sum = l->sum + r->sum;
    sum2 = l->sum2 + r->sum2;
  }
  long long get(int a, int b) {
    if (b < beg || end < a) return 0;
    if (a <= beg && end <= b) return sum;
    return l->get(a, b) + r->get(a, b);
  }
  long long get2(int a, int b) {
    if (b < beg || end < a) return 0;
    if (a <= beg && end <= b) return sum2;
    return l->get2(a, b) + r->get2(a, b);
  }
};
long long f1(int k) {
  long long ret = 0;
  for (int i = x; i < k; i++) ret += 1LL * ((a[k] - (k - i)) - a[i]) * w[i];
  return ret;
}
long long f1_(int k, no& seg) {
  long long ret = (a[k] - k) * seg.get(x, k - 1) + seg.get2(x, k - 1);
  return ret;
}
long long f2(int k) {
  long long ret = 0;
  for (int i = y; k < i; --i) ret += 1LL * (a[i] - (a[k] + (i - k))) * w[i];
  return ret;
}
long long f2_(int k, no& seg) {
  long long ret = (k - a[k]) * seg.get(k + 1, y) - seg.get2(k + 1, y);
  return ret;
}
long long bs(no& seg) {
  int beg = x, end = y, mid;
  while (beg < end) {
    mid = (beg + end) >> 1;
    if (seg.get(x, mid - 1) > seg.get(mid + 1, y)) {
      if (end == mid) break;
      end = mid;
    } else {
      if (beg == mid) break;
      beg = mid;
    }
  }
  long long ret = LINF;
  for (int i = beg; i <= end; ++i) ret = min(ret, f1_(i, seg) + f2_(i, seg));
  return ret;
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  no seg(1, n);
  while (q--) {
    scanf("%d %d", &x, &y);
    if (x > 0)
      printf("%d\n", bs(seg) % MOD);
    else
      w[-x] = y, seg.upd(-x, y);
  }
}
