#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return (b ? __gcd(a, b) : a);
}
template <typename T>
T lcm(T a, T b) {
  return (a * (b / gcd(a, b)));
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream &operator<<(ostream &os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream &operator<<(ostream &os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.first << ":" << m.second << ") ";
  return os << "}";
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n, k;
  cin >> n >> k;
  vector<int> v(k);
  vector<int> used(n, 1);
  for (int i = 0; i < (k); ++i) cin >> v[i];
  int curl = n, cnt = 0;
  for (int j = 0; j < (k); ++j) {
    v[j] = v[j] % curl;
    curl--;
    for (int i = 0; i < (v[j]); ++i) {
      do {
        cnt++;
        cnt %= n;
      } while (!used[cnt]);
    }
    used[cnt] = 0;
    cout << cnt + 1 << " ";
    do {
      cnt++;
      cnt %= n;
    } while (!used[cnt]);
  }
  return 0;
}
