#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> child;
  int n, k;
  scanf("%d %d", &n, &k);
  int *A = new int[k];
  for (int i = 0; i < k; ++i) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i < n; ++i) {
    child.push_back(i + 1);
  }
  int count = 0;
  for (int i = 0; i < k; ++i) {
    count += A[i];
    count = count % (n - i);
    printf("%d ", child[count]);
    child.erase(child.begin() + count);
    if (count >= child.size()) count = 0;
  }
  return 0;
}
