#include <bits/stdc++.h>
using namespace std;
const long long N = 200020;
long long n, m, c[N], cur = 1, sum, b, ans[N], head = 1;
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) cin >> c[i];
  for (long long i = 0; i <= 60; i++) {
    if (sum == n - 1) {
      for (long long j = 1; j <= m; j++)
        if (c[j] == head) ans[j] = n;
      break;
    }
    for (long long j = 1; j <= m; j++)
      if (!ans[j] && (b ^ (((c[j] - head + cur) / cur) & 1)))
        ans[j] = sum + ((((c[j] - head + cur) / cur) + !b) >> 1);
    sum += (((n - head + cur) / cur + !b) >> 1);
    long long lashead = head;
    head = b ? head : head + cur;
    b ^= (((n - lashead + cur) / cur) & 1);
    cur <<= 1;
  }
  for (long long i = 1; i <= m; i++) cout << ans[i] << endl;
  return 0;
}
