#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20) + 5;
vector<long long> a[N];
vector<long long> s[N];
int l[N];
int n, m;
long long fuck(int x, long long h) {
  if (x > n || x < 1) {
    return 0;
  }
  if (h < 0) {
    return 0;
  }
  int n = a[x].size();
  int p = lower_bound(a[x].begin(), a[x].end(), h) - a[x].begin();
  return p * h - s[x][p];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 2; i <= n; i++) {
    scanf("%d", l + i);
  }
  for (int i = 1; i <= n; i++) {
    long long d = 0;
    int u = i;
    while (u != 1) {
      d += l[u];
      u /= 2;
      a[u].push_back(d);
    }
  }
  for (int i = 1; i <= n; i++) {
    sort(a[i].begin(), a[i].end());
    s[i].resize(a[i].size() + 1);
    for (int j = 0; j < a[i].size(); j++) {
      s[i][j + 1] = s[i][j] + a[i][j];
    }
  }
  for (int wtf = 0; wtf < m; wtf++) {
    int x;
    long long y;
    scanf("%d%lld", &x, &y);
    long long ans = y;
    ans += fuck(x, y);
    while (x != 1) {
      int fa = x / 2;
      y -= l[x];
      if (y > 0) {
        ans += y;
      } else {
        break;
      }
      if (x == 2 * fa && 2 * fa + 1 <= n) {
        if (y - l[2 * fa + 1] > 0) {
          ans += y - l[2 * fa + 1];
        }
        ans += fuck(2 * fa + 1, y - l[2 * fa + 1]);
      }
      if (x == 2 * fa + 1) {
        if (y - l[2 * fa] > 0) {
          ans += y - l[2 * fa];
        }
        ans += fuck(2 * fa, y - l[2 * fa]);
      }
      x = fa;
    }
    printf("%lld\n", ans);
  }
}
