#include <bits/stdc++.h>
int stack[105], top_index;
void pop() {
  if (top_index == 0) return;
  stack[top_index - 1] = -1;
  top_index--;
}
void push(int num) { stack[top_index++] = num; }
int top() {
  if (top_index == 0) return 0;
  return stack[top_index - 1];
}
int main() {
  int nChild, eliminate_index, leader_index;
  int i, j, nK, kstep, buffer[105], buffer_count, eliminate_num;
  while (scanf("%d%d", &nChild, &nK) == 2) {
    leader_index = 0;
    top_index = 0;
    for (i = 0; i < nChild; i++) push(i + 1);
    for (i = 0; i < nK; i++) {
      scanf("%d", &kstep);
      eliminate_index = (leader_index + kstep) % top_index;
      for (j = top_index - 1, buffer_count = 0; j > eliminate_index; j--) {
        buffer[buffer_count++] = top();
        pop();
      }
      eliminate_num = top();
      pop();
      leader_index = top_index;
      printf("%d ", eliminate_num);
      for (j = buffer_count - 1; j >= 0; j--) push(buffer[j]);
    }
  }
  return 0;
}
