#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
const int N = 1e6 + 10;
int n, q, pos;
int a[N], w[N];
long long s1[N << 2], s2[N << 2], sum;
void pu(int o) {
  s1[o] = s1[(o << 1)] + s1[((o << 1) | 1)];
  s2[o] = (s2[(o << 1)] + s2[((o << 1) | 1)]) % P;
}
void update(int o, int l, int r, int first, int v) {
  if (l == r) {
    s1[o] = v;
    s2[o] = (long long)v * (a[l] - l) % P;
    return;
  }
  if (((l + r) >> 1) >= first)
    update((o << 1), l, ((l + r) >> 1), first, v);
  else
    update(((o << 1) | 1), ((l + r) >> 1) + 1, r, first, v);
  pu(o);
}
long long qry1(int o, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return s1[o];
  long long ans = 0;
  if (((l + r) >> 1) >= ql) ans += qry1((o << 1), l, ((l + r) >> 1), ql, qr);
  if (((l + r) >> 1) < qr)
    ans += qry1(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr);
  return ans;
}
long long qry2(int o, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return s2[o];
  long long ans = 0;
  if (((l + r) >> 1) >= ql) ans = qry2((o << 1), l, ((l + r) >> 1), ql, qr);
  if (((l + r) >> 1) < qr)
    (ans += qry2(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr)) %= P;
  return ans;
}
void find(int o, int l, int r, int ql, int qr) {
  if (pos) return;
  if (l == r) return pos = sum >= s1[o] ? l + 1 : l, void();
  if (ql <= l && r <= qr) {
    if (sum >= s1[o])
      sum -= s1[o], find(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr);
    else
      find((o << 1), l, ((l + r) >> 1), ql, qr);
    return;
  }
  if (((l + r) >> 1) >= ql) find((o << 1), l, ((l + r) >> 1), ql, qr);
  if (((l + r) >> 1) < qr) find(((o << 1) | 1), ((l + r) >> 1) + 1, r, ql, qr);
}
void build(int o, int l, int r) {
  if (l == r) {
    s1[o] = w[l], s2[o] = (long long)(a[l] - l) * w[l];
    return;
  }
  build((o << 1), l, ((l + r) >> 1)),
      build(((o << 1) | 1), ((l + r) >> 1) + 1, r);
  pu(o);
}
long long qry(int l, int r) {
  return qry2(1, 1, n, l, r) + qry1(1, 1, n, l, r) * (pos - a[pos]) % P;
}
long long an[N];
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);
  build(1, 1, n);
  for (int i = 1; i <= q; ++i) {
    int first, second;
    scanf("%d%d", &first, &second);
    if (first < 0)
      update(1, 1, n, -first, second);
    else {
      sum = qry1(1, 1, n, first, second) / 2, pos = 0;
      find(1, 1, n, first, second);
      printf("%lld\n", ((qry(pos + 1, second) - qry(first, pos)) % P + P) % P);
    }
  }
}
