#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(1LL * (beg - a[beg]) * w[beg] % MOD) {
    if (beg != end)
      l = new no(beg, mid), r = new no(mid + 1, end), sum = l->sum + r->sum,
      sum2 = (l->sum2 + r->sum2) % MOD;
  }
  ~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) % MOD);
    (pos <= mid ? l : r)->upd(pos, newval);
    sum = l->sum + r->sum;
    sum2 = l->sum2 + r->sum2 % MOD;
  }
  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)) % MOD;
  }
};
long long f1_(int k, no& seg) {
  long long ret =
      ((((a[k] - k) * seg.get(x, k - 1) % MOD) + seg.get2(x, k - 1) + MOD) %
           MOD +
       MOD) %
      MOD;
  return ret;
}
long long f2_(int k, no& seg) {
  long long ret =
      ((((k - a[k]) * seg.get(k + 1, y) % MOD) - seg.get2(k + 1, y) + MOD) %
           MOD +
       MOD) %
      MOD;
  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;
    }
  }
  if (seg.get(x, beg - 1) <= seg.get(x, y) / 2 &&
      seg.get(x, beg) >= seg.get(x, y) / 2)
    return (f1_(beg, seg) + f2_(beg, seg)) % MOD;
  return (f1_(end, seg) + f2_(end, seg)) % MOD;
}
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);
  }
}
