#include <bits/stdc++.h>
using namespace std;
list<int> a;
int main() {
  int n, k, m;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    a.push_back(i);
  }
  list<int>::iterator it = a.begin(), tmp;
  while (k--) {
    scanf("%d", &m);
    m %= a.size();
    for (int i = 0; i < m; i++) {
      it++;
      if (it == a.end()) it++;
    }
    printf("%d ", *it);
    tmp = it;
    it++;
    if (it == a.end()) it++;
    a.erase(tmp);
  }
  return 0;
}
