#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n, q, a[200005];
long long t[524333], w[200005];
struct T {
  long long t[200005];
  void add(int x, long long k) {
    while (x <= n) t[x] += k, x += (x & -x);
  }
  long long sum(int x) {
    long long s = 0;
    while (x) s += t[x], x -= (x & -x);
    return s;
  }
  long long get(int l, int r) { return sum(r) - sum(l - 1); }
} f1, f2;
int fnd(int k, long long o) {
  if (k > 262143) return k - 262143;
  int lc = k << 1;
  if (t[lc] >= o) return fnd(lc, o);
  return fnd(lc ^ 1, o - t[lc]);
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i), a[i] = a[i] - i + 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", w + i);
    t[262143 + i] = w[i];
    f1.add(i, w[i]);
    f2.add(i, w[i] * 1ll * a[i] % 1000000007ll);
  }
  for (int i = 262143; i; --i) t[i] = t[i << 1] + t[(i << 1) ^ 1];
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0) {
      l = -l;
      f1.add(l, -w[l]);
      f2.add(l, -(w[l] * 1ll * a[l] % 1000000007ll));
      w[l] = r;
      f1.add(l, w[l]);
      f2.add(l, w[l] * 1ll * a[l] % 1000000007ll);
      int k = l + 262143;
      t[k] = r;
      do {
        k >>= 1;
        t[k] = t[k << 1] + t[(k << 1) ^ 1];
      } while (k > 1);
      continue;
    }
    long long L = f1.sum(l - 1), R = f1.sum(r), O = R - L;
    int k = fnd(1, L + (O + 1ll) / 2ll);
    long long ans =
        a[k] * 1ll * (f1.get(l, k - 1) % 1000000007ll) % 1000000007ll -
        f2.get(l, k - 1) % 1000000007ll + f2.get(k + 1, r) % 1000000007ll -
        a[k] * 1ll * (f1.get(k + 1, r) % 1000000007ll) % 1000000007ll;
    ans = (ans % 1000000007ll + 1000000007ll) % 1000000007ll;
    printf("%I64d\n", ans);
  }
  return 0;
}
