#include <bits/stdc++.h>
using namespace std;
int n, k, i, j, m, t = 1, a[105], f[105];
int main() {
  cin >> n >> k;
  for (i = 1; i <= k; i++) cin >> a[i];
  for (i = 1; i <= n; i++) f[i] = i;
  m = n;
  for (i = 1; i <= k; i++) {
    a[i] %= m;
    if (a[i] != 0)
      for (j = t + 1; a[i] > 0; j++) {
        if (f[j] > 0) a[i]--;
        if (j == n && a[i] > 0) j = 0;
        t = j;
      }
    f[t] = 0, m--;
    if (t == 0)
      cout << n << " ";
    else
      cout << t << " ";
    for (j = t + 1;; j++) {
      if (j > n) j = 1;
      if (f[j] > 0) {
        t = j;
        break;
      }
    }
    if (t == n) t = 0;
  }
  return 0;
}
