#include <bits/stdc++.h>
using namespace std;
const int mo = 1000000007;
const int N = 200005;
int n, q;
int a[N], w[N];
long long cntw[N * 4];
int val[N * 4];
void build(int k, int l, int r) {
  if (l == r) {
    cntw[k] = w[l];
    val[k] = 1ll * w[l] * a[l] % mo;
    return;
  }
  int mid = (l + r) / 2;
  build(k * 2, l, mid);
  build(k * 2 + 1, mid + 1, r);
  cntw[k] = cntw[k * 2] + cntw[k * 2 + 1];
  val[k] = (val[k * 2] + val[k * 2 + 1]) % mo;
}
void change(int k, int l, int r, int p, int v) {
  if (l == r) {
    cntw[k] = v;
    val[k] = 1ll * v * a[l] % mo;
    return;
  }
  int mid = (l + r) / 2;
  if (p <= mid)
    change(k * 2, l, mid, p, v);
  else
    change(k * 2 + 1, mid + 1, r, p, v);
  cntw[k] = cntw[k * 2] + cntw[k * 2 + 1];
  val[k] = (val[k * 2] + val[k * 2 + 1]) % mo;
}
long long askw(int k, int l, int r, int x, int y) {
  if (l == x && r == y) return cntw[k];
  int mid = (l + r) / 2;
  if (y <= mid) return askw(k * 2, l, mid, x, y);
  if (x > mid) return askw(k * 2 + 1, mid + 1, r, x, y);
  return askw(k * 2, l, mid, x, mid) + askw(k * 2 + 1, mid + 1, r, mid + 1, y);
}
int findpos(int k, int l, int r, long long v) {
  if (l == r) return l;
  int mid = (l + r) / 2;
  if (cntw[k * 2] <= v) return findpos(k * 2 + 1, mid + 1, r, v - cntw[k * 2]);
  return findpos(k * 2, l, mid, v);
}
int askcnt(int k, int l, int r, int x, int y) {
  if (l == x && r == y) return val[k];
  int mid = (l + r) / 2;
  if (y <= mid) return askcnt(k * 2, l, mid, x, y);
  if (x > mid) return askcnt(k * 2 + 1, mid + 1, r, x, y);
  return (askcnt(k * 2, l, mid, x, mid) +
          askcnt(k * 2 + 1, mid + 1, r, mid + 1, y)) %
         mo;
}
int calc(int l, int mid, int r) {
  int ans = 0;
  if (mid >= l) {
    ans = mo - askcnt(1, 1, n, l, mid);
    ans = (ans + 1ll * askw(1, 1, n, l, mid) % mo * a[mid] % mo) % mo;
  }
  if (mid < r) {
    ans = (ans + askcnt(1, 1, n, mid + 1, r)) % mo;
    ans = (ans + mo - 1ll * askw(1, 1, n, mid + 1, r) % mo * a[mid] % mo) % mo;
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] += n - i;
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  build(1, 1, n);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x < 0)
      change(1, 1, n, -x, y);
    else {
      long long sum = askw(1, 1, n, x, y);
      long long leftv = (sum + 1) / 2;
      if (x != 1) leftv += askw(1, 1, n, 1, x - 1);
      int mid = findpos(1, 1, n, leftv - 1);
      printf("%d\n", calc(x, mid, y));
    }
  }
}
