#include <bits/stdc++.h>
struct node {
  int data;
  struct node *link;
};
struct node *head, *newnode;
int main() {
  int n, k;
  long long a, b;
  struct node *temp;
  head = NULL;
  scanf("%d %d", &n, &k);
  int i = 1;
  while (i <= n) {
    newnode = (struct node *)malloc(sizeof(struct node));
    newnode->link = NULL;
    newnode->data = i;
    if (head == NULL) {
      head = temp = newnode;
    } else {
      temp->link = newnode;
      temp = newnode;
    }
    i++;
  }
  temp->link = head;
  temp = head;
  while (k--) {
    scanf("%lld", &a);
    b = a % n;
    if (b == 0) {
      temp = head;
      while (temp->link != head) {
        temp = temp->link;
      }
    } else {
      while (b > 0) {
        temp = head;
        head = head->link;
        b--;
      }
    }
    temp->link = head->link;
    printf("%d ", head->data);
    temp = head;
    head = head->link;
    free(temp);
    n--;
  }
  return 0;
}
