#include <bits/stdc++.h>
using namespace std;
const int infinity = 2000000999 / 2;
const long long int inff = 4000000000000000999;
template <class T>
T get() {
  T a;
  cin >> a;
  return a;
}
template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U>& par) {
  out << "[" << par.first << ";" << par.second << "]";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const set<T>& cont) {
  out << "{";
  for (const auto& x : cont) out << x << ", ";
  out << "}";
  return out;
}
template <class T, class U>
ostream& operator<<(ostream& out, const map<T, U>& cont) {
  out << "{";
  for (const auto& x : cont) out << x << ", ";
  out << "}";
  return out;
}
template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i) out << " ";
    out << v[i];
  }
  out << endl;
  return out;
}
bool ccw(complex<long double> p, complex<long double> a,
         complex<long double> b) {
  if ((conj(a - p) * (b - p)).imag() <= 0)
    return false;
  else
    return true;
}
struct intervalac {
  int N;
  long long int P;
  vector<int> start, range;
  vector<long long int> sucty;
  vector<long long int> zamod, premod;
  intervalac(int n, vector<long long int>& W, vector<long long int>& A) {
    N = pow(2, ceil(log2(n)));
    P = 1000000007;
    start.resize(2 * N, 0);
    range.resize(2 * N, N);
    sucty.resize(2 * N, 0);
    zamod.resize(2 * N, 0);
    premod.resize(2 * N, 0);
    for (int i = 2; i < 2 * N; i++) {
      range[i] = range[i / 2] / 2;
      start[i] = start[i / 2] + (i % 2) * range[i];
    }
    for (int i = N + n - 1; i > 0; i--) {
      if (i < N) {
        sucty[i] = sucty[i * 2] + sucty[i * 2 + 1];
        zamod[i] = (zamod[i * 2] + zamod[i * 2 + 1]) % P;
        premod[i] = (premod[i * 2] + premod[i * 2 + 1]) % P;
      } else {
        sucty[i] = W[i - N];
        zamod[i] = (W[i - N] * ((A[i - N] + n - (i - N)) % P)) % P;
        premod[i] = (W[i - N] * ((P + (i - N) - A[i - N]) % P)) % P;
        if (0) cout << "premod[" << i << "] = " << premod[i] << endl;
      }
    }
  }
  void update(int p, long long int w, long long int a, int n, int id) {
    if (0)
      cout << "Update " << p << " -> " << w << " on " << a << " v ["
           << start[id] << ", " << start[id] + range[id] << ") id: " << id
           << endl;
    if (start[id] > p || start[id] + range[id] <= p) return;
    if (range[id] == 1) {
      sucty[id] = w;
      zamod[id] = (w * ((a + n - p) % P)) % P;
      premod[id] = (w * ((P + p - a) % P)) % P;
      return;
    }
    update(p, w, a, n, id * 2);
    update(p, w, a, n, id * 2 + 1);
    sucty[id] = sucty[id * 2] + sucty[id * 2 + 1];
    zamod[id] = (zamod[id * 2] + zamod[id * 2 + 1]) % P;
    premod[id] = (premod[id * 2] + premod[id * 2 + 1]) % P;
    if (0)
      cout << "sucet[" << id << "] = " << sucty[id * 2] << " + "
           << sucty[id * 2 + 1] << endl;
  }
  pair<int, int> get_median(int z, int k, long long int sum, int id) {
    if (z >= start[id] + range[id] || k <= start[id]) {
      return {-1, 0};
    }
    if (1 == range[id]) {
      if (sum <= sucty[id]) return {start[id], sucty[id]};
      return {-1, sucty[id]};
    }
    if (0)
      cout << "Hladame prve so suctom aspon " << sum << " v org.[" << z << "; "
           << k << ") teraz id = " << id << " [" << start[id] << ", "
           << range[id] << ") sucet tuna " << sucty[id] << endl;
    if (z <= start[id] && k >= start[id] + range[id]) {
      if (sucty[id] < sum) return {-1, sucty[id]};
      pair<int, int> res = get_median(z, k, sum, id * 2);
      if (res.first != -1) return res;
      sum -= res.second;
      return get_median(z, k, sum, id * 2 + 1);
    }
    if (sucty[id] < sum) {
      return {-1, get_sucet(z, k, id)};
    }
    pair<int, int> res = get_median(z, k, sum, id * 2);
    if (res.first != -1) return res;
    sum -= res.second;
    return get_median(z, k, sum, id * 2 + 1);
  }
  int get_sucet(int z, int k, int id) {
    if (z >= start[id] + range[id] || k <= start[id]) return 0;
    if (z <= start[id] && k >= start[id] + range[id]) return sucty[id];
    return get_sucet(z, k, id * 2) + get_sucet(z, k, id * 2 + 1);
  }
  long long int get_zamod(int z, int k, int id) {
    if (z >= start[id] + range[id] || k <= start[id]) return 0;
    if (z <= start[id] && k >= start[id] + range[id]) return zamod[id];
    return (get_zamod(z, k, id * 2) + get_zamod(z, k, id * 2 + 1)) % P;
  }
  long long int get_premod(int z, int k, int id) {
    if (z >= start[id] + range[id] || k <= start[id]) return 0;
    if (z <= start[id] && k >= start[id] + range[id]) return premod[id];
    return (get_premod(z, k, id * 2) + get_premod(z, k, id * 2 + 1)) % P;
  }
};
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  int n = get<int>();
  int q = get<int>();
  vector<long long int> A, W;
  for (int i = 0; i < (int)n; i++) A.push_back(get<int>());
  for (int i = 0; i < (int)n; i++) W.push_back(get<long long int>());
  long long int P = 1000000007;
  intervalac I(n, W, A);
  for (int i = 0; i < (int)q; i++) {
    int x = get<int>();
    int y = get<int>();
    if (x < 0) {
      int id = -x;
      I.update(id - 1, y, A[id - 1], n, 1);
    } else {
      x--;
      long long int suc = I.get_sucet(x, y, 1);
      if (0) cout << "Sucet na [" << x << "; " << y << "] je " << suc << endl;
      long long int half = (suc + 1) / 2;
      int ind = I.get_median(x, y, half, 1).first;
      long long int zac = A[ind] - (ind - x);
      if (0)
        cout << "Half: " << half << " median je na " << ind
             << " teda budu v intervale [" << zac << "; " << zac + (y - x)
             << ")" << endl;
      long long int za = I.get_zamod(ind + 1, y, 1);
      long long int pre = I.get_premod(x, ind, 1);
      long long int sucza = I.get_sucet(ind + 1, y, 1) % P;
      long long int sucpre = I.get_sucet(x, ind, 1) % P;
      if (0)
        cout << "Posunutie <- " << za << " - " << sucza << " * (" << A[ind]
             << " -- (" << n << " - " << ind << ")" << endl;
      if (0)
        cout << " + "
             << ((P + za - ((sucza * ((A[ind] + (n - ind)) % P))) % P) % P)
             << endl;
      long long int res =
          ((P + za - ((sucza * ((A[ind] + (n - ind)) % P))) % P) % P +
           (P + pre - (sucpre * ((P + ind - A[ind]) % P)) % P) % P) %
          P;
      cout << res << endl;
    }
  }
}
