#include <bits/stdc++.h>
using namespace std;
int n, q;
int a[200005];
long long w[200005], t[800005];
void build(int l, int r, int pos) {
  if (l == r) {
    t[pos] = w[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, (pos << 1));
  build(mid + 1, r, (pos << 1) + 1);
  t[pos] = t[pos << 1] + t[(pos << 1) + 1];
}
void upd(int l, int r, int pos, long long val, int qpos) {
  if (l == r) {
    t[pos] = val;
    w[qpos] = val;
    return;
  }
  int mid = (l + r) >> 1;
  if (qpos > mid)
    upd(mid + 1, r, (pos << 1) + 1, val, qpos);
  else
    upd(l, mid, (pos << 1), val, qpos);
  t[pos] = t[pos << 1] + t[(pos << 1) + 1];
}
long long query(int l, int r, int pos, int ql, int qr) {
  if (l >= ql && r <= qr) return t[pos];
  if (l > qr || r < ql) return 0ll;
  int mid = (l + r) >> 1;
  return query(l, mid, pos << 1, ql, qr) +
         query(mid + 1, r, (pos << 1) + 1, ql, qr);
}
long long R(int l, int r) {
  if (l == r) return 0ll;
  int mid = (l + r) >> 1;
  return (R(mid + 1, r) + R(l, mid) +
          (query(1, n, 1, l, mid) % 1000000007) * (a[r] - r + mid - a[mid])) %
         1000000007;
}
long long L(int l, int r) {
  if (l == r) return 0ll;
  int mid = (l + r) >> 1;
  return (L(l, mid) + L(mid + 1, r) +
          (query(1, n, 1, mid + 1, r) % 1000000007) *
              (a[mid + 1] - a[l] + l - mid - 1)) %
         1000000007;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  build(1, n, 1);
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      upd(1, n, 1, y, -1 * x);
    } else {
      if (x == y) {
        cout << "0\n";
        continue;
      }
      int l = x, r = y;
      long long sum = query(1, n, 1, x, y);
      while (l < r) {
        int mid = (l + r) >> 1;
        long long m = query(1, n, 1, x, mid);
        if (m < (sum >> 1))
          l = mid + 1;
        else
          r = mid;
      }
      cout << (R(x, l) + L(l, y)) % 1000000007 << '\n';
    }
  }
  return 0;
}
