#include <bits/stdc++.h>
using namespace std;
const int N = 200005, mod = 1e9 + 7;
inline long long read() {
  long long X = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    X = (X << 3) + (X << 1) + ch - '0', ch = getchar();
  return X * w;
}
int n, Q, a[N], w[N], c2[N];
long long c1[N];
void add(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
void add1(int x, long long d) {
  for (; x <= n; x += x & -x) c1[x] += d;
}
void add2(int x, int d) {
  for (; x <= n; x += x & -x) add(c2[x], d);
}
long long ask1(int x) {
  long long ans = 0;
  for (; x; x -= x & -x) ans += c1[x];
  return ans;
}
int ask2(int x) {
  int ans = 0;
  for (; x; x -= x & -x) add(ans, c2[x]);
  return ans;
}
void opt1(int i, int nw) {
  add1(i, -w[i]);
  add2(i, (-1ll * w[i] * a[i] % mod + mod) % mod);
  w[i] = nw;
  add1(i, w[i]);
  add2(i, 1ll * w[i] * a[i] % mod);
}
void opt2(int L, int R) {
  long long t = ask1(L - 1);
  long long sum = ask1(R) - t;
  int le = L, ri = R, mid, ans = R;
  while (le <= ri) {
    mid = (le + ri) >> 1;
    long long v = ask1(mid) - t;
    if (v * 2 >= sum)
      ri = mid - 1, ans = mid;
    else
      le = mid + 1;
  }
  long long v11 = ask2(ans) - ask2(L - 1),
            v12 = -1ll * a[ans] * ((ask1(ans) - t) % mod) % mod;
  long long v21 = ask2(R) - ask2(ans),
            v22 = -1ll * a[ans] * ((ask1(R) - ask1(ans)) % mod) % mod;
  long long Ans = (v21 + v22 - v11 - v12) % mod;
  Ans = (Ans + mod) % mod;
  printf("%I64d\n", Ans);
}
int main() {
  n = read(), Q = read();
  for (int i = 1; i <= n; i++) a[i] = read() - i + n;
  for (int i = 1; i <= n; i++) {
    w[i] = read();
    add1(i, w[i]);
    add2(i, 1ll * w[i] * a[i] % mod);
  }
  while (Q--) {
    int x = read(), y = read();
    if (x < 0)
      opt1(-x, y);
    else
      opt2(x, y);
  }
  return 0;
}
