#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, i, d;
  cin >> n >> d;
  vector<long long int> vec(d);
  for (i = 0; i < d; i++) cin >> vec[i];
  long long int lead = 0, tobere;
  vector<long long int> a;
  for (i = 0; i < n; i++) a.push_back(i + 1);
  n++;
  for (auto x : vec) {
    n--;
    if (x <= (n - 1 - lead))
      tobere = lead + x;
    else
      tobere = (lead + x - n) % n;
    cout << a[tobere] << " ";
    if (tobere == (n - 1))
      lead = 0;
    else
      lead = tobere;
    a.erase(a.begin() + tobere);
  }
  return 0;
}
