#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 7;
const long long maxn = 3e5 + 7;
const double pi = acos(-1.0);
const double eps = 0.0000000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline void pr2(T x, int k = 64) {
  long long i;
  for (i = 0; i < k; i++) fprintf(stderr, "%d", (x >> i) & 1);
  putchar(' ');
}
template <typename T>
inline void add_(T &A, int B, long long MOD = M) {
  A += B;
  (A >= MOD) && (A -= MOD);
}
template <typename T>
inline void mul_(T &A, long long B, long long MOD = M) {
  A = (A * B) % MOD;
}
template <typename T>
inline void mod_(T &A, long long MOD = M) {
  A %= MOD;
  A += MOD;
  A %= MOD;
}
template <typename T>
inline void max_(T &A, T B) {
  (A < B) && (A = B);
}
template <typename T>
inline void min_(T &A, T B) {
  (A > B) && (A = B);
}
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = (long long)a * a % M)
    if (b & 1) ret = (long long)ret * a % M;
  return ret;
}
int n, m, q;
char str[maxn];
int startTime;
void startTimer() { startTime = clock(); }
void printTimer() {
  fprintf(stderr, "/--- Time: %ld milliseconds ---/\n", clock() - startTime);
}
inline int lowbit(int x) { return x & -x; }
int A[maxn], w[maxn];
long long sumw[maxn], sumaw[maxn];
inline void update(long long A[], int x, long long val) {
  for (; x <= n; x += lowbit(x)) A[x] += val;
}
inline void update(int x, int val) {
  update(sumw, x, val - w[x]);
  update(sumaw, x, M + (long long)(val - w[x]) * A[x] % M);
  w[x] = val;
}
inline long long query(long long A[], int x) {
  long long ret = 0;
  for (; x; x -= lowbit(x)) ret += A[x];
  return ret;
}
inline long long query(long long A[], int l, int r) {
  return query(A, r) - query(A, l - 1);
}
inline long long query(int l, int x, int r) {
  long long ret = 0;
  ret += query(sumw, l, x) % M * A[x] % M - query(sumaw, l, x) % M;
  ret += -query(sumw, x, r) % M * A[x] % M + query(sumaw, x, r) % M;
  return ret;
}
int main() {
  int i, k;
  scanf("%d%d", &n, &q);
  for (i = 1; i <= n; i++) scanf("%d", &A[i]), A[i] -= i;
  for (i = 1; i <= n; i++) scanf("%d", &k), update(i, k);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (l < 0)
      update(-l, r);
    else {
      int L = l, R = r;
      r++;
      while (l + 1 < r) {
        int mid = (l + r) / 2;
        if (query(sumw, L, mid - 1) - query(sumw, mid, R) < 0)
          l = mid;
        else
          r = mid;
      }
      printf("%I64d\n", (query(L, l, R) % M + M) % M);
    }
  }
}
