#include <bits/stdc++.h>
const int maxn = 1000005;
std::vector<long long> g[maxn], s[maxn];
int n, m, d[maxn][2];
void dfs(int u) {
  if ((u << 1) > n) return;
  dfs(u << 1), dfs(u << 1 | 1);
  int i = 0, j = 0, c[2] = {u << 1, u << 1 | 1};
  while (i < g[c[0]].size() && j < g[c[1]].size()) {
    if (g[c[0]][i] + d[u][0] < g[c[1]][j] + d[u][1])
      g[u].push_back(g[c[0]][i] + d[u][0]), i++;
    else
      g[u].push_back(g[c[1]][j] + d[u][1]), j++;
  }
  while (i < g[c[0]].size()) g[u].push_back(g[c[0]][i] + d[u][0]), i++;
  while (j < g[c[1]].size()) g[u].push_back(g[c[1]][j] + d[u][1]), j++;
}
long long ask(int a, int h) {
  if (h <= 0 || a > n) return 0;
  int l = 0, r = g[a].size() - 1, tmp = 0, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (g[a][mid] < h)
      tmp = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return 1ll * h * (tmp + 1) - s[a][tmp];
}
int main() {
  g[1].push_back(0);
  scanf("%d %d", &n, &m);
  for (int i = 2; i <= n; i++)
    g[i].push_back(0), scanf("%d", &d[i >> 1][i & 1]);
  dfs(1);
  for (int i = 1; i <= n; i++) {
    s[i].resize(g[i].size());
    for (int j = 1; j < g[i].size(); j++) s[i][j] = s[i][j - 1] + g[i][j];
  }
  int a, h, H;
  long long ans;
  while (m--) {
    scanf("%d %d", &a, &h), H = h;
    ans = ask(a, h), h -= d[a >> 1][a & 1];
    for (int i = a >> 1, j = a ^ 1; i; j = i ^ 1, i >>= 1) {
      if (h <= 0) break;
      ans += h + ask(j, h - d[i][j & 1]);
      h -= d[i >> 1][i & 1];
    }
    printf("%lld\n", ans);
  }
  return 0;
}
