#include <bits/stdc++.h>
using namespace std;
template <class T>
int chkmax(T& a, T b) {
  if (b > a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
int chkmin(T& a, T b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class iterator>
void output(iterator begin, iterator end, ostream& out = cerr) {
  while (begin != end) {
    out << (*begin) << " ";
    begin++;
  }
  out << '\n';
}
template <class T>
void output(T x, ostream& out = cerr) {
  output(x.begin(), x.end(), out);
}
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long long MOD = 1e9 + 7;
struct data {
  long long val, cnt, sum;
  data() : val(0), cnt(0), sum(0) {}
  data(long long _x) : val(0), cnt(1), sum(_x) {}
  data(long long _val, long long _cnt, long long _sum)
      : val(_val), cnt(_cnt), sum(_sum) {}
};
data merge(data a, data b) {
  return data((a.val + b.val + b.sum * a.cnt) % MOD, a.cnt + b.cnt,
              (a.sum + b.sum) % MOD);
}
struct st {
  vector<data> t;
  int n;
  void init(int _n) {
    n = _n;
    t.resize(4 * n);
  }
  void update(int pos, long long val, int v, int tl, int tr) {
    if (tl == tr) {
      t[v] = data(val);
    } else {
      int tm = (tl + tr) >> 1;
      if (pos <= tm)
        update(pos, val, v * 2, tl, tm);
      else
        update(pos, val, v * 2 + 1, tm + 1, tr);
      t[v] = merge(t[v * 2], t[v * 2 + 1]);
    }
  }
  void output(int v, int tl, int tr) {
    cerr << tl << ".." << tr << ": " << t[v].val << " " << t[v].cnt << " "
         << t[v].sum << '\n';
    if (tl < tr) {
      int tm = (tl + tr) >> 1;
      output(v * 2, tl, tm);
      output(v * 2 + 1, tm + 1, tr);
    }
  }
  data get(int l, int r, int v, int tl, int tr) {
    if (l > r) return data();
    if (l == tl && r == tr) return t[v];
    int tm = (tl + tr) >> 1;
    data res_l = get(l, min(r, tm), v * 2, tl, tm);
    data res_r = get(max(l, tm + 1), r, v * 2 + 1, tm + 1, tr);
    return merge(res_l, res_r);
  }
  void update(int pos, long long val) { update(pos, val, 1, 0, n - 1); }
  long long get(int l, int r) {
    data x = get(l, r, 1, 0, n - 1);
    return x.val;
  }
};
struct fenwick_mod {
  vector<long long> t;
  int n;
  void init(int _n) {
    n = _n;
    t.resize(n);
  }
  void update(int pos, long long val) {
    while (pos < n) {
      t[pos] = (t[pos] + val) % MOD;
      pos = (pos | (pos + 1));
    }
  }
  long long get(int r) {
    long long res = 0;
    while (r >= 0) {
      res += t[r];
      r = (r & (r + 1)) - 1;
    }
    return res % MOD;
  }
  long long get(int l, int r) { return (get(r) - get(l - 1) + MOD) % MOD; }
};
struct fenwick {
  vector<long long> t;
  int n;
  void init(int _n) {
    n = _n;
    t.resize(n);
  }
  void update(int pos, long long val) {
    while (pos < n) {
      t[pos] = (t[pos] + val);
      pos = (pos | (pos + 1));
    }
  }
  long long get(int r) {
    long long res = 0;
    while (r >= 0) {
      res += t[r];
      r = (r & (r + 1)) - 1;
    }
    return res;
  }
  long long get(int l, int r) { return get(r) - get(l - 1); }
};
const int mx = 2e5 + 228;
int n, q;
long long a[mx], w[mx];
fenwick_mod f_aw;
fenwick f_w;
st t, t_rev;
void update_index(int pos, long long new_w, long long old_w) {
  long long diff = (new_w - old_w + MOD) % MOD;
  f_w.update(pos, new_w - old_w);
  f_aw.update(pos, (a[pos] * diff) % MOD);
  t.update(pos, new_w);
  t_rev.update(n - pos - 1, new_w);
}
void init() {
  f_w.init(n);
  f_aw.init(n);
  t.init(n);
  t_rev.init(n);
  for (int i = 0; i < n; ++i) {
    update_index(i, w[i], 0);
  }
}
void update_query(int pos, long long new_w) {
  update_index(pos, new_w, w[pos]);
  w[pos] = new_w;
}
int get_max_left_pos(int l0, int r0, long long L) {
  int l = l0 - 1, r = r0;
  while (l != r) {
    int mid = (l + r) >> 1;
    if (a[mid + 1] < L + (long long)(mid + 1 - l0))
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
int get_min_right_pos(int l0, int r0, long long L) {
  int l = l0, r = r0 + 1;
  while (l != r) {
    int mid = (l + r) >> 1;
    if (a[mid] > L + (long long)(mid - l0))
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
long long to_mod(long long x) { return (x % MOD + MOD) % MOD; }
long long get_l(int l0, int r0, long long R) {
  long long res = to_mod(R * (f_w.get(l0, r0) % MOD) - f_aw.get(l0, r0) -
                         t_rev.get(n - 1 - r0, n - 1 - l0));
  return res;
}
long long get_r(int l0, int r0, long long L) {
  long long res =
      to_mod(f_aw.get(l0, r0) - (f_w.get(l0, r0) % MOD) * L - t.get(l0, r0));
  return res;
}
long long get(int l0, int r0, long long L) {
  int mid_pos = get_max_left_pos(l0, r0, L);
  long long res = to_mod(get_l(l0, mid_pos, L + mid_pos - l0) +
                         get_r(mid_pos + 1, r0, L + mid_pos + 1 - l0));
  return res;
}
long long get_query(int l0, int r0) {
  long long len = (long long)(r0 - l0 + 1), L = a[l0], R = a[r0] - len + 1;
  while (R > L) {
    long long MID = (L + R) >> 1;
    int max_left_pos = get_max_left_pos(l0, r0, MID + 1),
        min_right_pos = get_min_right_pos(l0, r0, MID + 1);
    long long wl = f_w.get(l0, max_left_pos), wr = f_w.get(min_right_pos, r0);
    if (wl <= wr)
      L = MID + 1;
    else
      R = MID;
  }
  long long ans = get(l0, r0, L);
  return ans % MOD;
}
signed main() {
  fast_io();
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> w[i];
  }
  init();
  for (int i = 0; i < q; ++i) {
    int id;
    long long val;
    cin >> id >> val;
    if (id < 0) {
      update_query(-id - 1, val);
    } else {
      cout << get_query(id - 1, (int)val - 1) << '\n';
    }
  }
}
