#include <bits/stdc++.h>
int n, m;
int a[111];
void nxt(int &x) {
  x++;
  if (x > n) x = 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) a[i] = i;
  int cur = 1;
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    x %= (n - i);
    for (int j = 0; j < x; j++) {
      nxt(cur);
      while (!a[cur]) nxt(cur);
    }
    printf("%d%c", cur, i < m - 1 ? ' ' : '\n');
    a[cur] = 0;
    while (!a[cur]) nxt(cur);
  }
  return 0;
}
