#include <bits/stdc++.h>
using namespace std;
const long long e = 1e5 + 9;
const long long mod = 1e9 + 7;
vector<long long> adj[e];
bool visited[e];
long long dem = 0;
long long n, x, y;
int main() {
  long long n, q;
  cin >> n >> q;
  while (q--) {
    long long x;
    cin >> x;
    long long ans = 0;
    for (long long now = n; now; now /= 2) {
      if (x & 1) {
        ans = ans + (x + 1) / 2;
        break;
      }
      if ((now & 1) == 0) {
        ans = ans + now / 2;
        x = x / 2;
      } else {
        ans = ans + (now + 1) / 2;
        x = x / 2;
        x = x - 1;
        if (x == 0) x = now / 2;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
