#include <bits/stdc++.h>
using namespace std;
long long n, k, m, t, mk = ((long long)(1e17 + 1)), q = 0;
long long a[int(3e5 + 600)];
vector<long long> v;
int main() {
  cin >> n >> m;
  v.resize(n);
  for (int i = 1; i <= n; i++) v[i - 1] = i;
  t = 0;
  for (int i = 0; i < m; i++) {
    cin >> k;
    t = (t + k) % v.size();
    cout << v[t] << " ";
    v.erase(v.begin() + t);
  }
  return 0;
}
