#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, vector<T> a) {
  os << "( ";
  for (T& x : a) os << x << " ";
  os << ")\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> a) {
  os << "( ";
  for (T x : a) os << x << " ";
  os << ")\n";
  return os;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> a) {
  os << "(" << a.first << " " << a.second << ") ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, complex<T> a) {
  os << "(r=" << a.real() << " i=" << a.imag() << ") ";
  return os;
}
const int base = 1000000007;
long long power(long long a, long long n, long long mod = base) {
  long long r = 1;
  while (n) {
    if (n & 1) r = r * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
const int nmax = 200011;
int afdsdfdvc[nmax * 4], ajfndsjfe[nmax * 4], sum[nmax * 4], a[nmax], w[nmax];
void xxx(int first, int L, int H) {
  int second = first << 1, z = second + 1, M = (L + H) >> 1;
  sum[first] = (sum[second] + sum[z]) % base;
  ajfndsjfe[first] =
      (ajfndsjfe[second] +
       sum[second] % base * long long(a[H] - a[M] - (H - M)) + ajfndsjfe[z]) %
      base;
  afdsdfdvc[first] =
      (afdsdfdvc[second] + afdsdfdvc[z] +
       sum[z] % base * long long(a[M + 1] - a[L] - (M - L + 1))) %
      base;
}
void build(int first, int L, int H) {
  if (L == H) {
    sum[first] = w[H];
    return;
  }
  build((first << 1), L, ((L + H) >> 1));
  build((first << 1) + 1, ((L + H) >> 1) + 1, H);
  xxx(first, L, H);
}
int u, v, val;
void update(int first, int L, int H) {
  if (v < L || H < u) return;
  if (u <= L && H <= v) {
    w[H] = sum[first] = val;
    return;
  }
  update((first << 1), L, ((L + H) >> 1));
  update((first << 1) + 1, ((L + H) >> 1) + 1, H);
  xxx(first, L, H);
}
int pos, ans, posL, posH;
void show(int first, int L, int H) {
  if (v < L || H < u) return;
  if (u <= L && H <= v && (L >= pos || H <= pos)) {
    if (L >= pos) {
      if (posL == posH) --posL;
      ans = (ans + afdsdfdvc[first] +
             sum[first] % base * long long(a[L] - posH)) %
            base;
      posH += H - L + 1;
    } else {
      if (posL == posH) ++posH;
      ans = (ans + ajfndsjfe[first] +
             sum[first] % base * long long(posL - a[H])) %
            base;
      posL -= H - L + 1;
    }
    return;
  }
  if (H <= pos) {
    show((first << 1) + 1, ((L + H) >> 1) + 1, H);
    show((first << 1), L, ((L + H) >> 1));
  } else {
    show((first << 1), L, ((L + H) >> 1));
    show((first << 1) + 1, ((L + H) >> 1) + 1, H);
  }
}
int n;
long long g[nmax];
void ud(int first, int val) {
  for (; first <= n; first += first & -first) g[first] += val;
}
long long sh(int first) {
  long long ans = 0;
  for (; first; first -= first & -first) ans += g[first];
  return ans;
}
int main(int argc, char** argv) {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", w + i);
    ud(i, w[i]);
  }
  build(1, 1, n);
  while (q--) {
    scanf("%d%d", &u, &v);
    if (u < 0) {
      u = -u;
      val = v;
      v = u;
      ud(u, val - w[u]);
      v = u;
      update(1, 1, n);
      continue;
    }
    int d = u, c = v;
    pos = u;
    long long su = sh(u - 1), s = sh(v) - su;
    while (d <= c) {
      int g = (d + c) / 2;
      if (2 * (sh(g) - su) <= s) {
        pos = g;
        d = g + 1;
      } else
        c = g - 1;
    }
    pos = min(v, pos + 1);
    ans = 0;
    posL = posH = a[pos];
    show(1, 1, n);
    printf("%d\n", ans);
  }
}
