#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 10;
int read() {
  int xx = 0, ww = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') ww = -ww;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    xx = 10 * xx + ch - 48;
    ch = getchar();
  }
  return xx * ww;
}
deque<int> q;
int n, k, a;
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; i++) q.push_back(i);
  for (int i = 1; i <= k; i++) {
    a = read();
    a %= q.size();
    while (a--) {
      q.push_back(q.front());
      q.pop_front();
    }
    int v = q.front();
    q.pop_front();
    if (i != 1) printf(" ");
    printf("%d", v);
  }
  puts("");
  return 0;
}
