#include <bits/stdc++.h>
using namespace std;
int n, q, x[600005], M = 1, at;
long long y[600005], z[600005], sum;
int ta, tb, tc;
inline long long query(int a, int b) {
  long long re = 0;
  a += M - 1;
  b += M + 1;
  while ((a ^ b) != 1) {
    if (!(a & 1)) re += y[a ^ 1];
    if (b & 1) re += y[b ^ 1];
    a >>= 1;
    b >>= 1;
  }
  return re;
}
inline long long dquery(int a, int b, long long c) {
  long long yy = 0;
  long long zz = 0;
  a += M - 1;
  b += M + 1;
  while ((a ^ b) != 1) {
    if (!(a & 1)) {
      yy += y[a ^ 1];
      zz += z[a ^ 1];
    }
    if (b & 1) {
      yy += y[b ^ 1];
      zz += z[b ^ 1];
    }
    a >>= 1;
    b >>= 1;
  }
  return (yy * c + 1000000007 - zz) % 1000000007;
}
int main() {
  scanf("%d%d", &n, &q);
  while (M <= n) M <<= 1;
  ta = M | n;
  for (int i = M | 1; i <= ta; i++) {
    scanf("%d", x + i);
    x[i] -= i;
  }
  ta = M | n;
  for (int i = M | 1; i <= ta; i++) {
    scanf("%lld", y + i);
    z[i] = y[i] * x[i] % 1000000007;
  }
  for (int i = (M | n) >> 1; i; i--) {
    ta = i << 1;
    tb = ta | 1;
    y[i] = y[ta] + y[tb];
    z[i] = z[ta] + z[tb];
  }
  while (q--) {
    scanf("%d%d", &ta, &tb);
    if (ta < 0) {
      ta = M - ta;
      y[ta] = tb;
      z[ta] = y[ta] * x[ta] % 1000000007;
      while (ta) {
        ta >>= 1;
        tb = ta << 1;
        tc = tb | 1;
        y[ta] = y[tb] + y[tc];
        z[ta] = z[tb] + z[tc];
      }
    } else {
      sum = query(ta, tb);
      sum /= 2;
      if (ta != 1) sum += query(1, ta - 1);
      at = 1;
      while (!(at & M)) {
        at <<= 1;
        if (sum >= y[at]) {
          sum -= y[at];
          at |= 1;
        }
      }
      at ^= M;
      if (ta < at)
        sum = dquery(ta, at - 1, x[M | at]);
      else
        sum = 0;
      if (at < tb) {
        sum += 1000000007 - dquery(at + 1, tb, x[M | at]);
        if (sum >= 1000000007) sum -= 1000000007;
      }
      printf("%lld\n", sum);
    }
  }
  return 0;
}
