#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  vector<int> g(n);
  iota(g.begin(), g.end(), 1);
  for (int i = 0; i < q; i++) cin >> a[i];
  int sz = n;
  int k = 0;
  for (int i = 0; i < n && sz >= 0; i++) {
    int dif = a[i] % sz;
    int j = k;
    while (dif > 0) {
      j++;
      j = j % n;
      if (g[j] == 0) continue;
      dif--;
    }
    a[i] = g[j];
    g[j] = 0;
    sz--;
    if (sz == 0) break;
    k = (j + 1) % n;
    while (g[k] == 0) k = (k + 1) % n;
  }
  for (int i = 0; i < q; i++) cout << a[i] << " ";
  return 0;
}
