#include <bits/stdc++.h>
using namespace std;
class P {
 public:
  long long x, y;
  P() {}
  P(long long xx, long long yy) {
    x = xx;
    y = yy;
  }
  P operator+(P p) {
    P res = P(x + p.x, y + p.y);
    if (res.y >= 1000000007LL) {
      res.y -= 1000000007LL;
      res.x++;
    }
    return res;
  }
  P operator-(P p) {
    P res = P(x - p.x, y - p.y);
    if (res.y < 0) {
      res.y += 1000000007LL;
      res.x--;
    }
    return res;
  }
  P operator*(long long a) {
    P res = P(a * x, a * y);
    res.x += res.y / 1000000007LL;
    res.y %= 1000000007LL;
    return res;
  }
  bool operator<(const P &p) const { return x != p.x ? x < p.x : y < p.y; }
};
int n, q;
class segtree {
 public:
  P dp[200005];
  segtree() { memset(dp, 0, sizeof(dp)); }
  void update(int i, long long v) {
    P res = P(v / 1000000007LL, v % 1000000007LL);
    i++;
    while (i <= n) {
      dp[i] = dp[i] + res;
      i += i & -i;
    }
  }
  P query(int i) {
    P res = P(0, 0);
    while (i > 0) {
      res = res + dp[i];
      i -= i & -i;
    }
    return res;
  }
  P query(int a, int b) { return query(b) - query(a); }
};
segtree seg;
segtree seg2;
long long a[200005], w[200005];
long long sum[200005];
P C(int v, int aa, int bb) {
  int l = -1, r = bb - aa + 1;
  while (l + 1 < r) {
    int mid = (l + r) / 2;
    int pos = a[v + mid];
    if (pos <= aa + mid)
      l = mid;
    else
      r = mid;
  }
  l++;
  P res = P(0, 0);
  P wv1 = seg2.query(v, v + l);
  P wv2 = seg2.query(v + l, v + (bb - aa) + 1);
  res = wv1 * (aa - v) - seg.query(v, v + l);
  res = res + seg.query(v + l, v + (bb - aa) + 1) - wv2 * (aa - v);
  return res;
}
int main(void) {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    scanf("%lld", &w[i]);
  }
  for (int i = 0; i < n; i++) {
    seg.update(i, w[i] * (a[i] - i));
    seg2.update(i, w[i]);
  }
  for (int i = 0; i < q; i++) {
    int t, v;
    scanf("%d%d", &t, &v);
    if (t < 0) {
      t = -t;
      t--;
      seg.update(t, (a[t] - t) * (v - w[t]));
      seg2.update(t, v - w[t]);
      w[t] = v;
    } else {
      long long l = a[t - 1], r = a[v - 1] + 1LL;
      while (l + 1LL < r) {
        long long mid = (l + r) / 2;
        P v1 =
            C(t - 1, mid - 1, mid - 1 + (v - t)) - C(t - 1, mid, mid + (v - t));
        if (v1 < P(0, 0)) {
          r = mid;
        } else {
          l = mid;
        }
      }
      P ans = C(t - 1, l, l + (v - t));
      cout << ans.y << endl;
    }
  }
  return 0;
}
