#include <bits/stdc++.h>
using namespace std;
const long long DIM = 100007, maxN = 507, INF = 10000000000007,
                MOD = 1000000007;
long long n, q, x;
bool flag;
void solve() {
  cin >> n >> q;
  while (q--) {
    cin >> x;
    while (x % 2 == 0) x = n + x / 2;
    cout << x / 2 + 1 << '\n';
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
