#include <bits/stdc++.h>
using namespace std;
int a[110];
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    v.push_back(i + 1);
  }
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int lea = 0;
  for (int i = 0; i < m; i++) {
    lea = (lea + a[i]) % v.size();
    cout << v[lea] << " ";
    v.erase(v.begin() + lea);
  }
  return 0;
}
