#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[k + 1];
  int leader = 1;
  int mov;
  int ans;
  vector<int> v;
  for (int i = 1; i <= n; i++) {
    v.push_back(i);
  }
  for (int i = 1; i <= k; i++) {
    cin >> a[i];
    if (leader + a[i] > n) {
      mov = a[i] - n + leader;
      ans = mov % n;
      if (ans == 0) ans = n;
    } else {
      ans = leader + a[i];
    }
    cout << v[ans - 1] << " ";
    v.erase(v.begin() + (ans - 1));
    leader = ans;
    n = n - 1;
  }
  cout << endl;
  return 0;
}
