#include <bits/stdc++.h>

using namespace std;

const int maxn = (int)2e5 + 5;
const int mod = (int)1e9 + 7;

int n, q;
int a[maxn];
int w[maxn];

long long s[maxn * 4];
int f[maxn * 4], g[maxn * 4];

#define mid (ll + rr >> 1)

inline void unite(int i, int ll, int rr) {
  s[i] = s[i * 2 + 1] + s[i * 2 + 2];
  f[i] = (f[i * 2 + 1] + f[i * 2 + 2] + s[i * 2 + 2] % mod * (a[mid + 1] - a[ll])) % mod;
  g[i] = (g[i * 2 + 2] + g[i * 2 + 1] + s[i * 2 + 1] % mod * (a[rr] - a[mid])) % mod;
}

void build(int i, int ll, int rr) {
  if (ll < rr) {
    build(i * 2 + 1, ll, mid);
    build(i * 2 + 2, mid + 1, rr);
    unite(i, ll, rr);
  } else {
    s[i] = w[ll];
  }
}

void update(int p, int i, int ll, int rr) {
  if (p < ll || rr < p) {
    return;
  }
  if (ll == rr) {
    s[i] = w[p];
    return;
  }
  update(p, i * 2 + 1, ll, mid);
  update(p, i * 2 + 2, mid + 1, rr);
  unite(i, ll, rr);
}

long long sum(int l, int r, int i, int ll, int rr) {
  if (r < ll || rr < l) {
    return 0;
  }
  if (l <= ll && rr <= r) {
    return s[i];
  }
  return sum(l, r, i * 2 + 1, ll, mid) + sum(l, r, i * 2 + 2, mid + 1, rr);
}

int find(long long tot, int i, int ll, int rr) {
  if (ll == rr) {
    return ll;
  }
  if (s[i * 2 + 1] > tot) {
    return find(tot, i * 2 + 1, ll, mid);
  }
  return find(tot - s[i * 2 + 1], i * 2 + 2, mid + 1, rr);
}

int pos;

int query_left(int l, int r, int i, int ll, int rr) {
  if (r < ll || rr < l) {
    return 0;
  }
  if (l <= ll && rr <= r) {
    return (g[i] + s[i] * (a[pos] - a[rr])) % mod;
  }
  return (query_left(l, r, i * 2 + 1, ll, mid) + query_left(l, r, i * 2 + 2, mid + 1, rr)) % mod;
}

int query_right(int l, int r, int i, int ll, int rr) {
  if (r < ll || rr < l) {
    return 0;
  }
  if (l <= ll && rr <= r) {
    return (f[i] + s[i] * (a[ll] - a[pos])) % mod;
  }
  return (query_right(l, r, i * 2 + 1, ll, mid) + query_right(l, r, i * 2 + 2, mid + 1, rr)) % mod;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] -= i;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
  }
  build(0, 1, n);
  while (q--) {
    int x, y;
    cin >> x >> y;
    if (x < 0) {
      w[-x] = y;
      update(-x, 0, 1, n);
    } else {
      long long tot = (x > 1 ? sum(1, x - 1, 0, 1, n) : 0) + sum(x, y, 0, 1, n) / 2;
      pos = find(tot, 0, 1, n);
      cout << (query_left(x, pos, 0, 1, n) + query_right(pos, y, 0, 1, n)) % mod << '\n';
    }
  }
  return 0;
}
