#include <bits/stdc++.h>
using namespace std;
struct debugger {
  static void call(string::iterator it, string::iterator ed) {}
  template <typename T, typename... aT>
  static void call(string::iterator it, string::iterator ed, T a, aT&... rest) {
    string b;
    for (; *it != ','; ++it)
      if (*it != ' ') b += *it;
    cout << b << "=" << a << " ";
    call(++it, ed, rest...);
  }
};
int main() {
  long long int n, k, i, j;
  cin >> n >> k;
  long long int a[n + 10], arr[n + 10];
  for (i = 1; i <= n; i++) arr[i] = i;
  for (i = 0; i < k; i++) {
    cin >> a[i];
  }
  long long int siz = n;
  i = 1;
  for (long long int rep = 0; rep < k; rep++) {
    long long int ret = siz;
    ret = a[rep] % ret;
    int cnk = 0;
    for (;; i++) {
      if (i > n) i = 1;
      if (arr[i] == -1) continue;
      if (cnk >= ret) {
        arr[i] = -1;
        cout << i << " ";
        i++;
        if (i > n) i = 1;
        break;
      }
      if (arr[i] != -1) cnk++;
    }
    siz--;
  }
  return 0;
}
