#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[200];
bool live[200];
int main() {
  memset(live, true, sizeof(live));
  cin >> n >> k;
  for (int i = 0; i < k; i++) cin >> a[i];
  int L = 0;
  for (int i = 0; i < k; i++) {
    int sh = (a[i]) % (n - i);
    if (sh == 0) sh = n - i;
    int cnt = 0;
    int j = (L + 1) % n;
    while (!live[j]) j = (j + 1) % n;
    while (sh != 1 && cnt < sh - 1) {
      if (live[j]) cnt++;
      j = (j + 1) % n;
    }
    while (!live[j]) j = (j + 1) % n;
    cout << j + 1 << " ";
    live[j] = false;
    while (!live[j]) j = (j + 1) % n;
    L = j;
  }
  return 0;
}
