#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
long long n, q, a[N], w[N], seg[N << 2][2], sum[N << 2];
void Merge(int v, int tl, int tr) {
  int mid = (tl + tr) >> 1;
  seg[v][0] = seg[v << 1][0] + seg[v << 1 | 1][0] +
              1ll * (a[mid + 1] - a[tl] - (mid - tl + 1)) * sum[v << 1 | 1];
  seg[v][1] = seg[v << 1][1] +
              1ll * (a[tr] - a[mid] - (tr - mid)) * sum[v << 1] +
              seg[v << 1 | 1][1];
  sum[v] = sum[v << 1] + sum[v << 1 | 1];
}
void show(int v, int tl, int tr) {
  cout << v << " " << tl << " " << tr << " " << seg[v][0] << " " << seg[v][1]
       << " " << sum[v] << "\n";
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    seg[v][0] = seg[v][1] = 0;
    sum[v] = w[tl];
    return;
  }
  int mid = (tl + tr) >> 1;
  build(v << 1, tl, mid);
  build(v << 1 | 1, mid + 1, tr);
  Merge(v, tl, tr);
}
void update(int v, int tl, int tr, int p) {
  if (p > tr || p < tl) return;
  if (tl == tr) {
    seg[v][0] = seg[v][1] = 0;
    sum[v] = w[tl];
    return;
  }
  int mid = (tl + tr) >> 1;
  update(v << 1, tl, mid, p);
  update(v << 1 | 1, mid + 1, tr, p);
  Merge(v, tl, tr);
}
long long get(int v, int tl, int tr, int l, int r, long long x, int T) {
  if (l > tr || r < tl || l > r) return 0;
  if (l <= tl && tr <= r) {
    if (T == 1) {
      return seg[v][1] + 1ll * (x - a[tr] - (r - tr)) * sum[v];
    } else {
      return seg[v][0] + 1ll * (a[tl] - x - (tl - l)) * sum[v];
    }
  }
  int mid = (tl + tr) >> 1;
  return get(v << 1, tl, mid, l, r, x, T) +
         get(v << 1 | 1, mid + 1, tr, l, r, x, T);
}
long long G(int l, int r, long long x) {
  int id = upper_bound(a + 1, a + n + 1, x) - a - 1;
  if (id >= r) {
    return get(1, 1, n, l, r, x, 1);
  }
  if (id < l) {
    return get(1, 1, n, l, r, x, 0);
  }
  return get(1, 1, n, l, id, x, 1) + get(1, 1, n, id + 1, r, x + 1, 0);
}
bool check(long long x, int l, int r) {
  long long sum1 = G(l, r, x - 1), sum2 = G(l, r, x);
  if (sum2 <= sum1) return 1;
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  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, 1, n);
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      x *= -1;
      w[x] = y;
      update(1, 1, n, x);
    } else {
      int d = 0, up = 1e9 + 10;
      while (up - d > 1) {
        long long mid = (up + d) >> 1;
        if (check(mid, x, y)) {
          d = mid;
        } else {
          up = mid;
        }
      }
      long long ans = inf;
      for (int i = -1000; i <= 1000; i++) {
        ans = min(ans, G(x, y, d + i));
      }
      cout << ans % mod << "\n";
    }
  }
  return 0;
}
