#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXN = 200005;
int lowbit(int x) { return x & -x; }
void modx(long long& x) {}
long long sum(long long* bit, int x) {
  long long res = 0;
  while (x) {
    res += bit[x];
    modx(res);
    x -= lowbit(x);
  }
  return res;
}
long long sum(long long* bit, int l, int r) {
  return sum(bit, r) - sum(bit, l - 1);
}
void add(long long* bit, int x, long long v) {
  while (x < MAXN) {
    bit[x] += v;
    modx(bit[x]);
    x += lowbit(x);
  }
}
long long weights[MAXN];
long long weightSum[MAXN];
long long locs[MAXN];
long long locSum1[MAXN];
long long locSum2[MAXN];
int findMid(int l, int r) {
  long long total = sum(weightSum, l, r);
  int res = l;
  int lb = l, rb = r;
  while (lb <= rb) {
    int mid = (lb + rb) / 2;
    long long sums = sum(weightSum, l, mid);
    if (sums * 2 >= total) {
      res = mid;
      rb = mid - 1;
    } else {
      lb = mid + 1;
    }
  }
  return res;
}
long long getAns(int l, int r, int mid, bool isSmall = false) {
  if (l > r) {
    return 0;
  }
  long long res = 0;
  if (isSmall) {
    res = sum(locSum2, l, r) - (1e9 - mid) * sum(weightSum, l, r);
  } else {
    res = sum(locSum1, l, r) - (mid - 1) * sum(weightSum, l, r);
  }
  modx(res);
  return res;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &locs[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &weights[i]);
    add(weightSum, i, weights[i]);
    add(locSum1, i, (locs[i] - i) * 1ll * weights[i]);
    add(locSum2, i, (1e9 - locs[i] - (n - i)) * 1ll * weights[i]);
  }
  while (q--) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > 0) {
      int mid = findMid(a, b);
      long long ans = getAns(a, mid - 1, locs[mid] + (n - mid), true) +
                      getAns(mid + 1, b, locs[mid] - mid + 1);
      modx(ans);
      ans = (ans % MOD + MOD) % MOD;
      printf("%I64d\n", ans);
    } else {
      a = -a;
      add(weightSum, a, b - weights[a]);
      add(locSum1, a, (locs[a] - a) * 1ll * (b - weights[a]));
      add(locSum2, a, (1e9 - locs[a]) * 1ll * (b - weights[a]));
      weights[a] = b;
    }
  }
  return 0;
}
