#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
const long long mod = 1e9 + 7;
const long long N = 5e5;
const long long INF = 1e9 + 1;
long long n, m, a[N], p;
vector<long long> v;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    v.push_back(i);
  }
  for (int i = 1; i <= m; ++i) {
    cin >> a[i];
    p += (a[i] % v.size());
    p %= v.size();
    cout << v[p] << " ";
    v.erase(v.begin() + p);
  }
  return 0;
}
