#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, num, in = 0;
  vector<long long> v;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    v.push_back(i + 1);
  }
  while (k--) {
    cin >> num;
    num = num % v.size();
    if (num > v.size() - in) {
      cout << v[num - v.size() + in];
      v.erase(remove(v.begin(), v.end(), v[num - v.size() + in]), v.end());
      in = num - v.size() + in - 1;
    } else if (num == v.size() - in) {
      cout << v[0];
      in = 0;
      v.erase(remove(v.begin(), v.end(), v[0]), v.end());
    } else {
      if (num + in == v.size() - 1) {
        cout << v[num + in];
        v.erase(remove(v.begin(), v.end(), v[num + in]), v.end());
        in = 0;
      } else {
        cout << v[num + in];
        v.erase(remove(v.begin(), v.end(), v[num + in]), v.end());
        in = num + in;
      }
    }
    cout << " ";
  }
  return 0;
}
