#include <bits/stdc++.h>
using namespace std;
int living[102];
int arr[102];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) cin >> arr[i];
  int remain = n;
  int currentLeader = 1;
  for (int i = 0; i < k; i++) {
    int toMove = (arr[i] % remain);
    int index = currentLeader + 1;
    if (toMove == 0) {
      toMove = 1;
      index = currentLeader;
    }
    if (index > n) index = 1;
    int lastEliminated = -1;
    while (toMove) {
      if (living[index] == 0) {
        lastEliminated = index;
        toMove--;
      }
      index += 1;
      if (index > n) index = 1;
    }
    living[lastEliminated] = 1;
    remain--;
    cout << lastEliminated << " ";
    int newLeader = lastEliminated + 1;
    if (newLeader > n) newLeader = 1;
    while (living[newLeader]) {
      newLeader += 1;
      if (newLeader > n) newLeader = 1;
    }
    currentLeader = newLeader;
  }
  return 0;
}
