#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 600000;
int n, tests;
long long tw[N * 4];
long long twx[N * 4];
long long a[N], w[N];
void build(int v, int tl, int tr) {
  if (tl == tr) {
    tw[v] = w[tl];
    twx[v] = w[tl] * a[tl] % 1000000007;
    return;
  }
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  build(v * 2, tl, sdfjahlfasfh);
  build(v * 2 + 1, sdfjahlfasfh + 1, tr);
  tw[v] = tw[v * 2] + tw[v * 2 + 1];
  twx[v] = twx[v * 2] + twx[v * 2 + 1];
  twx[v] %= 1000000007;
}
void update(int v, int tl, int tr, int ps, int val) {
  if (tl == tr) {
    tw[v] = val;
    twx[v] = 1ll * a[ps] * val % 1000000007;
    return;
  }
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  if (ps <= sdfjahlfasfh)
    update(v * 2, tl, sdfjahlfasfh, ps, val);
  else
    update(v * 2 + 1, sdfjahlfasfh + 1, tr, ps, val);
  tw[v] = tw[v * 2] + tw[v * 2 + 1];
  twx[v] = twx[v * 2] + twx[v * 2 + 1];
  twx[v] %= 1000000007;
}
long long getw(int v, int tl, int tr, int l, int r) {
  if (l > r) return 0;
  if (tl == l && tr == r) return tw[v];
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  long long ret =
      getw(v * 2, tl, sdfjahlfasfh, l, min(r, sdfjahlfasfh)) +
      getw(v * 2 + 1, sdfjahlfasfh + 1, tr, max(sdfjahlfasfh + 1, l), r);
  return ret;
}
long long getwx(int v, int tl, int tr, int l, int r) {
  if (l > r) return 0;
  if (tl == l && tr == r) return twx[v];
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  long long ret =
      getwx(v * 2, tl, sdfjahlfasfh, l, min(r, sdfjahlfasfh)) +
      getwx(v * 2 + 1, sdfjahlfasfh + 1, tr, max(sdfjahlfasfh + 1, l), r);
  return ret % 1000000007;
}
int get_ps(int v, int tl, int tr, long long val) {
  if (tl == tr) return tl;
  int sdfjahlfasfh = tl + tr;
  sdfjahlfasfh /= 2;
  if (tw[v * 2] >= val) return get_ps(v * 2, tl, sdfjahlfasfh, val);
  val -= tw[v * 2];
  return get_ps(v * 2 + 1, sdfjahlfasfh + 1, tr, val);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> tests;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  build(1, 1, n);
  for (; tests; --tests) {
    int val1, val2;
    cin >> val1 >> val2;
    if (val1 < 0) {
      val1 *= -1;
      update(1, 1, n, val1, val2);
      w[val1] = val2;
    } else {
      long long pref = getw(1, 1, n, 1, val1 - 1);
      long long seg = getw(1, 1, n, val1, val2);
      long long need = pref + seg / 2;
      int ps = get_ps(1, 1, n, need);
      long long left_side = getwx(1, 1, n, val1, ps);
      long long right_side = getwx(1, 1, n, ps + 1, val2);
      long long ans =
          (getw(1, 1, n, val1, ps) % 1000000007) * 1ll * a[ps] - left_side;
      ans +=
          right_side - (getw(1, 1, n, ps + 1, val2) % 1000000007) * 1ll * a[ps];
      ans %= 1000000007;
      if (ans < 0) ans += 1000000007;
      cout << ans << "\n";
    }
  }
  return 0;
}
