#include <bits/stdc++.h>
using namespace std;
const long long int MAGIC = 1000000007;
long long int energy(const vector<int> &a, const vector<int> &w,
                     const vector<long long int> &ps, int l, int r) {
  long long int alls = ps[r] - ps[l - 1];
  long long int cs = 0;
  long long int res = 0;
  int pos = 0;
  for (int i = l; i <= r; ++i) {
    cs += w[i];
    if (cs < alls - cs) {
      res += (cs % MAGIC) * ((a[i + 1] - a[i] - 1) % MAGIC);
    } else {
      if (pos) {
        ++pos;
        res += (w[i] % MAGIC) * ((a[i] - pos) % MAGIC);
      } else {
        pos = a[i];
      }
    }
    res %= MAGIC;
  }
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<int> a(n + 1);
  vector<int> w(n + 1);
  vector<long long int> ps(n + 1);
  a[0] = w[0] = ps[0] = 0;
  for (int i = 1; i < n + 1; ++i) cin >> a[i];
  for (int i = 1; i < n + 1; ++i) {
    cin >> w[i];
    ps[i] = ps[i - 1] + w[i];
  }
  for (int i = 0; i < q; ++i) {
    int x, y;
    cin >> x >> y;
    if (x > 0)
      cout << energy(a, w, ps, x, y) << '\n';
    else
      w[-x] = y;
  }
  return 0;
}
