#include <bits/stdc++.h>
using namespace std;
int v[105];
vector<int> a;
vector<int>::iterator it;
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) a.push_back(i);
  for (int i = 0; i < k; i++) {
    scanf("%d", &v[i]);
  }
  int lead = 1;
  for (int i = 0; i < k; i++) {
    v[i] %= (n - i);
    for (it = a.begin(); it != a.end(); ++it) {
      if (*it == lead) break;
    }
    while (v[i]--) {
      it++;
      if (it == a.end()) it = a.begin();
    }
    printf("%d ", *it);
    if (i == k - 1) break;
    vector<int>::iterator aux = it;
    aux++;
    if (aux == a.end()) aux = a.begin();
    lead = *aux;
    a.erase(it);
  }
  printf("\n");
  return 0;
}
