#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
const double eps = 1e-5;
int a[105];
int vis[maxn], ans[maxn];
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < k; i++) scanf("%d", &a[i]);
    int pre = 1;
    for (int i = 0; i < k; i++) {
      int x;
      int step = a[i] % (n - i);
      x = pre;
      for (int j = 0; j < step; j++) {
        x = (x + 1) % n;
        if (x == 0) x = n;
        while (vis[x]) {
          x = (x + 1) % n;
          if (x == 0) x = n;
        }
      }
      printf("%d ", x);
      pre = (x + 1) % n;
      if (pre == 0) pre = n;
      while (vis[pre]) {
        pre = (pre + 1) % n;
        if (pre == 0) pre = n;
      }
      vis[x] = 1;
    }
    printf("\n");
  }
  return 0;
}
