#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m;     cin >> n >> m;     long long x;     for (int i = 0; i < m; i++) {       cin >> x;       if (x > n)         cout << 0 << endl;       else {         if (x % 2 == 1)           cout << x / 2 + 1 << endl;         else {           long long a = x, b, c = n;           while (1) {             if (a % 2 == 1) break;             b = a + (c - a / 2);             a = b;           }           cout << a / 2 + 1 << endl;         }       }     }   }   