#include <bits/stdc++.h>
using namespace std;
int vis[105];
int main() {
  int n, k, l, x, y = 0, cnt = 0, steps = 0;
  cin >> n >> k;
  l = 0;
  y = 0;
  while (k--) {
    cin >> x;
    cnt = 0;
    steps = x % (n - l);
    while (cnt < steps) {
      if (vis[y]) {
        y++;
        y %= n;
        continue;
      }
      cnt++;
      y++;
      y %= n;
    }
    while (vis[y]) y = (y + 1) % n;
    cout << y + 1 << " ";
    vis[y] = 1;
    y++;
    y %= n;
    while (vis[y]) y = (y + 1) % n;
    l++;
  }
  return 0;
}
