#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint inf = 1000000000000000007;
const int MOD = 1000000007;
lint calc(vector<lint> const& sm, vector<lint> const& len, lint h, lint x) {
  h -= x;
  if (h <= 0) return 0;
  lint res = 0;
  auto it = lower_bound(len.begin(), len.end(), h);
  int ind = it - len.begin();
  res = h * ind - sm[ind];
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> l(n);
  for (int i = 1; i <= n - 1; ++i) cin >> l[i];
  vector<int> a(m), h(m);
  for (int i = 0; i < m; ++i) cin >> a[i] >> h[i];
  vector<vector<lint>> tree(n + 1, vector<lint>(1, 0));
  vector<vector<lint>> subSum(n + 1);
  for (int i = n; i > 0; --i) {
    int w = l[i - 1];
    lint last = 0;
    subSum[i].push_back(0);
    sort(tree[i].begin(), tree[i].end());
    for (auto& c : tree[i]) {
      tree[i / 2].push_back(c + w);
      subSum[i].push_back(last + c);
      last += c;
    }
    subSum[i].push_back(inf);
  }
  for (int i = 0; i < m; ++i) {
    lint res = 0;
    lint buf = 0;
    res += calc(subSum[a[i]], tree[a[i]], h[i], buf);
    lint s = a[i] / 2;
    lint last = a[i];
    buf += l[a[i] - 1];
    while (s > 0) {
      res += max(0ll, h[i] - buf);
      if (s * 2 + 1 > n) {
        last = s;
        buf += l[s - 1];
        s /= 2;
        continue;
      }
      if (s * 2 == last)
        res += calc(subSum[s * 2 + 1], tree[s * 2 + 1],
                    h[i] - l[(s * 2 + 1) - 1], buf);
      else
        res += calc(subSum[s * 2], tree[s * 2], h[i] - l[s * 2 - 1], buf);
      last = s;
      buf += l[s - 1];
      s /= 2;
    }
    cout << res << "\n";
  }
  return 0;
}
